Skip to content
Advertisement

Consumer does not read messages from the Kafka topic (Akka Stream Kafka)

We use Akka Stream Kafka for producing and consuming messages and Strimzi Kafka cluster. Here are the versions if matters:

JavaScript

After a refactoring message consumer stopped working. We do have messages in the topic, but consumer just waits endlessly.

Here is the log fragment:

JavaScript

Some more points:

  1. Schema registry properly configured and good (otherwise producer would not work).
  2. Topic (and group coordinator) is good, I can consume messages via plain consumer like that:
JavaScript
  1. I use “earliest” reset config property, so it should see unconsumed messages.
  2. This is what I have in the topic when I run – in partition 1 I have messages at offset 51 and 52, and consumer coordinator set to offset 51 in log, so the message is there (in fact, it must read 2 messages I produced for this testing)

topic state

This is the place where the code stuck — I use blocking call to get 2 messages (and cannot get even 1)

JavaScript

Not really sure how to debug it. 8-(

[UPD 1]

Can it relate somehow to transactions? Bacause plain Akka Stream Consumer can see the messages and consume:

JavaScript

[UPD 2]

I turned on DEBUG level of logging and see my partitions are placed on pause:

JavaScript

[UPD 3] Does it have to do with auto created topics?

enter image description here

Advertisement

Answer

It’s hard to tell how it impacts, but consumer started working properly once I added this property to consumer:

JavaScript

Now sure what was the real cause, and why there was no error thrown, but adding property above helped, at least in my case.

Advertisement