I’ve written up a test using the Akka/Akka Streams framework in Scala (along with htm.java 0.6.13). Akka stream nodes are push and pull based. I can give you snippets if you’re interested - you would have to be familiar with Scala, though. There is a Java API as well, though I haven’t used it.
The basic approach to the actor is to wrap computeImmediate(..)
in the receive
method of the actor, under the case when an envelope from our Kafka topic is sent. The result from this is then “asked” back to the sender. An actor is single threaded and guarantees order so each actor processes receive
synchronously.
The actor constructor can then be wrapped up to create a Future
object, the Future
can then be wrapped into a Flow
object, and then the flow can be wired into a Graph
by setting up the Source
and Sink
. These can be built without Kafka (for test purposes) or wired up to Kafka for production.