aserrallerios / kcl-akka-stream

Custom Akka Stream Sources and Flows to interact with Kinesis streams using Kineis Client Library


Akka Stream Source for Kinesis Client Library travis-badge Bintray

For more information about Kinesis please visit the official documentation.

The KCL Source can read from several shards and rebalance automatically when other Workers are started or stopped. It also handles record sequence checkpoints.

For more information about KCL please visit the official documentation.


resolvers += "aserrallerios bintray" at ""
libraryDependencies += "aserrallerios" %% "kcl-akka-stream" % "0.1"


AWS KCL Worker Source & checkpointer

The KCL Worker Source needs to create and manage Worker instances in order to consume records from Kinesis Streams.

In order to use it, you need to provide a Worker builder and the Source settings:

val workerSourceSettings = KinesisWorkerSourceSettings(
    bufferSize = 1000,
    terminateStreamGracePeriod = 1 minute)
  val builder: IRecordProcessorFactory => Worker = { recordProcessorFactory =>
    new Worker.Builder()
        new KinesisClientLibConfiguration(
            import scala.sys.process._

The Source also needs an ExecutionContext to run the Worker's thread and to execute record checkpoints. Then the Source can be created as usual:

implicit val _ =
  KinesisWorker(builder, workerSourceSettings).to(Sink.ignore)

Committing records

The KCL Worker Source publishes messages downstream that can be committed in order to mark progression of consumers by shard. This process can be done manually or using the provided checkpointer Flow.

In order to use the Flow you can provide additional settings:

 val checkpointSettings = KinesisWorkerCheckpointSettings(100, 30 seconds)
  KinesisWorkerSource(builder, workerSourceSettings)
  KinesisWorker(builder, workerSourceSettings).to(


Copyright (c) 2018 Albert Serrallé

This version of kcl-akka-stream is released under the Apache License, Version 2.0 (see LICENSE.txt). By downloading and using this software you agree to the End-User License Agreement (EULA).

We build on a number of third-party software tools, with the following licenses:

Java Libraries

Third-Party software License
amazon-kinesis-client Amazon Software License