I have deployed two instances of an application. Both applications runs the same code and consumes from the same topic.
@KafkaListener( offsetReset = OffsetReset.EARLIEST, offsetStrategy = OffsetStrategy.DISABLED )
public class AppConsumer implements ConsumerRebalanceListener, KafkaConsumerAware {
@Topic("topic")
public void consumeAppInfo(@KafkaKey String name, @Body @Nullable String someString) {
...
}
}
I have a problem where only one of the applications consumes the message. The topic has only one partition, partition 0
, which i believe is default.
I have tried to add group-id and threads to the KafkaListener. This seems to work sometimes and other time not.
@KafkaListener(groupId="myGroup", threads=10)
What is the simplest solution to getting both applications to consume the same message?