Skip to content

Handle message deserialization failures gracefully to prevent poison message blocking#79

Closed
sergey-elmanov wants to merge 1 commit into
vgv:mainfrom
sergey-elmanov:fix-poison-message-rollback
Closed

Handle message deserialization failures gracefully to prevent poison message blocking#79
sergey-elmanov wants to merge 1 commit into
vgv:mainfrom
sergey-elmanov:fix-poison-message-rollback

Conversation

@sergey-elmanov
Copy link
Copy Markdown

This pull request improves error handling during message deserialization in the consumer code. The main change is that if a message fails to deserialize (for example, due to corrupted data), the error is caught and handled gracefully: the problematic row is skipped, allowing the consumer to continue processing other messages. This prevents a single "poison" message from blocking the queue.

Error handling and robustness improvements:

  • Wrapped message deserialization logic in ConsumerSchemaHelpers.read with a try-catch block. If deserialization fails, a MessageDeserializationException is thrown, including the message ID for easier debugging. [1] [2] [3]
  • In ConnectionAwareDatabaseConsumer, added logic to catch MessageDeserializationException during message retrieval. When caught, the row is skipped, and a comment explains that this allows the queue to continue processing and avoids blocking on poison messages.
  • Imported MessageDeserializationException in ConnectionAwareDatabaseConsumer.kt to support the new error handling.

@sergey-elmanov sergey-elmanov force-pushed the fix-poison-message-rollback branch from b3fddbd to 8e6e995 Compare May 15, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant