Overview

The Alpakka project is an open source initiative to implement stream-aware and reactive integration pipelines for Java and Scala. It is built on top of Akka Streams, and has been designed from the ground up to understand streaming natively and provide a DSL for reactive and stream-oriented programming, with built-in support for backpressure. Akka Streams is a Reactive Streams and JDK 9+ java.util.concurrent.Flow-compliant implementation and therefore fully interoperable with other implementations.

This Alpakka Kafka connector lets you connect Apache Kafka to Akka Streams. It was formerly known as Akka Streams Kafka and even Reactive Kafka.

Project Info

Project Info: Alpakka Kafka
Artifact
com.typesafe.akka
akka-stream-kafka
1.0.5
JDK versions
Adopt OpenJDK 8 with Hotspot
Adopt OpenJDK 11 with Hotspot
Scala versions2.12.8, 2.11.12, 2.13.0
JPMS module nameakka.stream.alpakka.kafka
License
Readiness level
Since 0.16, 2017-05-02
Home pagehttps://doc.akka.io/docs/alpakka-kafka/current
API documentation
Forums
Release notesIn the documentation
IssuesGithub issues
Sourceshttps://github.com/akka/alpakka-kafka

Matching Kafka Versions

Kafka client Scala Versions Akka version Alpakka Kafka Connector
2.1.1 2.13, 2.12, 2.11 2.5.x release 1.0.4
2.1.1 2.12, 2.11 2.5.x release 1.0.1
2.1.0 2.12, 2.11 2.5.x release 1.0
2.0.x 2.12, 2.11 2.5.x release 1.0-M1
1.1.x 2.12, 2.11 2.5.x release 0.20+
1.0.x 2.12, 2.11 2.5.x release 0.20+
0.11.x 2.12, 2.11 2.5.x release 0.19
Note

As Kakfka’s client protocol negotiates the version to use with the Kafka broker, you may use a Kafka client version that is different than the Kafka broker’s version.

These client can communicate with brokers that are version 0.10.0 or newer. Older or newer brokers may not support certain features. For example, 0.10.0 brokers do not support offsetsForTimes, because this feature was added in version 0.10.1. You will receive an UnsupportedVersionException when invoking an API that is not available on the running broker version.

Javadoc for KafkaConsumer

Dependencies

Maven
<dependency>
  <groupId>com.typesafe.akka</groupId>
  <artifactId>akka-stream-kafka_2.12</artifactId>
  <version>1.0.5</version>
</dependency>
sbt
libraryDependencies += "com.typesafe.akka" %% "akka-stream-kafka" % "1.0.5"
Gradle
dependencies {
  compile group: 'com.typesafe.akka', name: 'akka-stream-kafka_2.12', version: '1.0.5'
}

This connector depends on Akka 2.5.x and note that it is important that all akka-* dependencies are in the same version, so it is recommended to depend on them explicitly to avoid problems with transient dependencies causing an unlucky mix of versions.

The table below shows Alpakka Kafka’s direct dependencies and the second tab shows all libraries it depends on transitively.

Direct dependencies
OrganizationArtifactVersionLicense
com.typesafe.akkaakka-stream_2.122.5.23Apache License, Version 2.0
org.apache.kafkakafka-clients2.1.1The Apache Software License, Version 2.0
org.scala-lang.modulesscala-collection-compat_2.122.1.1Apache-2.0
org.scala-langscala-library2.12.8Apache-2.0
Dependency tree
com.typesafe.akka    akka-stream_2.12    2.5.23    Apache License, Version 2.0
    com.typesafe.akka    akka-actor_2.12    2.5.23    Apache License, Version 2.0
        com.typesafe    config    1.3.3    Apache License, Version 2.0
        org.scala-lang.modules    scala-java8-compat_2.12    0.8.0    BSD 3-clause
            org.scala-lang    scala-library    2.12.8    Apache-2.0
        org.scala-lang    scala-library    2.12.8    Apache-2.0
    com.typesafe.akka    akka-protobuf_2.12    2.5.23    Apache License, Version 2.0
        org.scala-lang    scala-library    2.12.8    Apache-2.0
    com.typesafe    ssl-config-core_2.12    0.3.7    Apache-2.0
        com.typesafe    config    1.3.3    Apache License, Version 2.0
        org.scala-lang.modules    scala-parser-combinators_2.12    1.1.1    BSD 3-clause
            org.scala-lang    scala-library    2.12.8    Apache-2.0
        org.scala-lang    scala-library    2.12.8    Apache-2.0
    org.reactivestreams    reactive-streams    1.0.2    CC0
    org.scala-lang    scala-library    2.12.8    Apache-2.0
org.apache.kafka    kafka-clients    2.1.1    The Apache Software License, Version 2.0
    com.github.luben    zstd-jni    1.3.7-1    BSD 2-Clause License
    org.lz4    lz4-java    1.5.0    The Apache Software License, Version 2.0
    org.slf4j    slf4j-api    1.7.25    MIT License
    org.xerial.snappy    snappy-java    1.1.7.2    The Apache Software License, Version 2.0
org.scala-lang.modules    scala-collection-compat_2.12    2.1.1    Apache-2.0
    org.scala-lang    scala-library    2.12.8    Apache-2.0
org.scala-lang    scala-library    2.12.8    Apache-2.0

Scala and Java APIs

There are two separate packages named akka.kafka.scaladsl and akka.kafka.docs.javadsl with the API for Scala and Java. These packages contain Producer and Consumer classes with factory methods for the various Akka Streams Flow, Sink and Source that are producing or consuming messages to/from Kafka.

Contributing

Please feel free to contribute to Alpakka and the Alpakka Kafka connector by reporting issues you identify, or by suggesting changes to the code. Please refer to our contributing instructions to learn how it can be done.

We want Akka and Alpakka to strive in a welcoming and open atmosphere and expect all contributors to respect our code of conduct.

Found an error in this documentation? The source code for this page can be found here. Please feel free to edit and contribute a pull request.