Skip to content

Conversation

@acogoluegnes
Copy link
Contributor

The message ignored listener in the consumer coordinator calls the processed method on ignored messages to "simulate" the processing (e.g. increment a counter to provide a credit in the middle of the chunk).

The MessageProcessedCallback is the chunk context in this case, which can be null, depending on the consumer flow strategy. The listener could trigger a null-pointer exception by calling the processed method on the context.

This commit adds a null check to avoid the null-pointer exception. A null chunk context (MessageProcessedCallback) means the custom behavior of the consumer flow strategy is performed when the chunk starts, so the call to MessageHandler.Context#processed() is not necessary.

The message ignored listener in the consumer coordinator calls the
processed method on ignored messages to "simulate" the processing (e.g.
increment a counter to provide a credit in the middle of the chunk).

The MessageProcessedCallback is the chunk context in this case, which
can be null, depending on the consumer flow strategy. The listener could
trigger a null-pointer exception by calling the processed method on the
context.

This commit adds a null check to avoid the null-pointer exception. A null
chunk context (MessageProcessedCallback) means the custom behavior of
the consumer flow strategy is performed when the chunk starts, so the
call to MessageHandler.Context#processed() is not necessary.
@acogoluegnes acogoluegnes added the bug Something isn't working label Dec 22, 2025
@acogoluegnes acogoluegnes added this to the 1.5.0 milestone Dec 22, 2025
@acogoluegnes acogoluegnes merged commit c30e6cf into main Dec 22, 2025
3 checks passed
@acogoluegnes acogoluegnes deleted the null-proof-message-ignored-listener branch December 22, 2025 09:36
github-actions bot pushed a commit that referenced this pull request Dec 22, 2025
…ener

Null-proof message ignored listener
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants