liveBook · Manning

Alpakka Kafka

As explained in Akka in Action, Second Edition

Alpakka Kafka is an Alpakka connector library that integrates Akka Streams with Apache Kafka for producing and consuming records.

Alpakka Kafka connects Apache Kafka with Akka Streams through a reactive, asynchronous interface. Kafka topics provide potentially infinite streams of records, while Akka Streams supplies nonblocking backpressure for consumers and producers. section 14.0 section 14.1

A Kafka consumer typically requires:

  • ConsumerSettings containing key and value deserializers, a bootstrap server, and a group ID. section 14.1
  • Offset management appropriate to the delivery requirement: plainSource does not commit offsets by default, so restarts do not resume automatically. section 14.1

Basic consumer

A minimal consumer creates an ActorSystem, loads the Akka Kafka configuration, builds ConsumerSettings with StringDeserializer instances, connects to 127.0.0.1:9092, joins group01, subscribes to test, prints each record's key, value, and offset, and runs with Sink.ignore.

For processing that must tolerate duplicate delivery, transactional sources and sinks provide effectively-once semantics: processing remains at least once, while duplicates are deduplicated. Each running application needs a unique transactional ID, and consumers must use read-committed isolation. section 14.3

How Akka in Action, Second Edition covers it

How deep it goes
Explains consumer configuration, subscriptions, offsets, basic pipelines, and transactional delivery semantics.
Examples
Uses a Scala consumer that prints records and a transactional pipeline that moves messages between Kafka topics.
What it assumes
Assumes Scala, Akka Streams, Kafka topics, serialization, consumer groups, and offsets; supplies the consumer configuration pattern.
What you can do after
Operate/configure consumers and transactional pipelines with deserializers, subscriptions, offsets, bootstrap servers, and unique transactional IDs.
How it connects
Connects Akka Streams, actors, Apache Kafka, Kafka Streams, Reactive Streams, JSON serialization, offsets, and Kafka transactions.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Akka in Action, Second Edition. The section links point to the parts of the book it draws on.