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
