Akka and Kafka working together

Hi,
I’m a beginner and trying to understand how lagom microservices work. While I understand that we need to use Kafka to persist messages to propagate information to other microservices who would be interested in consuming that information so that they can continue with their task without needing the source service to be available, what I want to understand is what role is Akka playing in this flow. Can someobody please explain it to me in layman’s term ? Assuming we have 3 microservices, say A, B and C and all of them need to talk to each other and if we are persisting messages inside Kafka and the other services are subscribing to the relevant topics , what role does Akka play here ? Also what role will Akka play if its a clustered setup ?

Will be grateful if somebody can explain.
Many thanks.

1 Like

Hi,

there is no direct role that Akka is having in kafka subscribing.
Lagom Broker API is using Alpakka Kafka as underline implementation. This is akka stream implementation that is not cluster based.
Multiple instances of one Lagom service are using one kafka consumer group (name derived by default from service descriptor name).
Kafka ensures that each kafka topic partition is consumed by a single consumer from the group. So this ensures that one event/message will be consumed only by one Lagom service instance.

Hope this helps.

Br,
Alan

1 Like