How to connect standalone lagom client to kafka events?

kafka
scala
(Michael Bespalov) #1

I have a lagom service publishing its events on a kafka topic. I also have a standalone lagom client for that service and I would like to have it subscribe to the events topic.

Here’s how I’m creating the client:

    val lagomClientFactory: StandaloneLagomClientFactory = new StandaloneLagomClientFactory("A")
      with StaticServiceLocatorComponents
      with AhcWSComponents {
      override def staticServiceUri: URI = URI.create(...)
    }

    val client = lagomClientFactory.serviceClient.implement[MyService]

I tried then taking the client and calling:

client.myEvents.subscribe.atLeastOnce(Flow[MyEvent].mapAsync(1) {
   ...
}

But it seems to have no effect. Is it possible to connect a standalone lagom client to a kafka topic? Any help would be appreciated

(Alan Klikic) #2

Hi,

Standalone lagom client does not include Kafka Client.
You need to add it also. Check Lagom Kafka client - Subscriber only Services

Br,
Alan