1

When using StreamMessageListenerContainer a subscription for a consumer group can be created by calling:

receive(consumer, readOffset, streamListener)

Is there a way to configure the container/subscription so that it will always attempt to re-process any PENDING messages before moving on to polling for new messages?

The goal would be to keep retrying any message that wasn't acknowledged until it succeeds, to ensure that the stream of events is always processed in exactly the order it was produced.

My understanding is if we specify the readOffset as '>' then on every poll it will use '>' and it will never see any messages from the PENDING list.

If we provide a specific message id, then it can see messages from the PENDING list, but the way the subscription updates the lastMessageId is like this:

pollState.updateReadOffset(raw.getId().getValue());
V record = convertRecord(raw);
listener.onMessage(record);

So even if the listener throws an exception, or just doesn't acknowledge the message id, the lastMessageId in pollState is still updated to this message id and won't be seen again on the next poll.

2
  • did you fixed this probem? @Bryan Bende Commented May 9, 2022 at 13:58
  • @Dolphin Unfortunately no, I decided to not use the provided message listener container and instead implement a custom polling thread that maintains the last successfully processed offset, and just uses streamOperations.read(options, lastOffset); the lastOffset is persisted to disk by the application so on restart the polling thread starts from there Commented May 10, 2022 at 14:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.