0

I am reading from kafka consumer, then persist message to db and send to producer on different topic. My akka streams app stops running in few seconds after launch.

Here is how my stream looks like.

Consumer.committableSource(consumerSettings, Subscriptions.topics(config.getString("topic")))
  .mapAsync(8) {
    msg => dbPersistActor.ask(msg.record.value()).map(_=> msg)
  }.async
  .map {
    msg =>
      ProducerMessage.Message(new ProducerRecord("test-output", msg.record.key(), msg.record.value())
        , passThrough = msg.committableOffset)
  }.via(Producer.flexiFlow(producerSettings))
  .map(_.passThrough)
  .via(Committer.flow(committerSettings))
  .runWith(Sink.ignore)
Levi Ramsey
  • 18,884
  • 1
  • 16
  • 30
priya
  • 109
  • 4
  • Can you show us any log messages? Have you checked exit code of your consumer application? – Shekhar Sep 16 '21 at 08:55
  • is this using Alpakka ? Also, what does rest of code look like ? – sarveshseri Sep 16 '21 at 09:01
  • yes I am using Alpakka. There isn't much in that class. Even dbPersistActor just have a print statement right now. – priya Sep 16 '21 at 09:41
  • @shekhar I didn't see anything useful in log. It gracefully stops consumer by leaving consumer group and then stopping – priya Sep 16 '21 at 09:44
  • Can you add some log/ print statements like what is in the "msg.record.value()"? By default Akka consumer exits / fails silently without spitting out error but this behaviour can be changed. Have a look at Akka documentation and you will find how to handle error condition. If you add this code then you will see what is happening. – Shekhar Sep 16 '21 at 11:33
  • @shekhar thanks for suggestion, I am new to akka and didn't know it won't log exception by default. Looks like there was some exception in pipeline. – priya Sep 17 '21 at 05:52

0 Answers0