Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set context for copied message on retry #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sevaorlov
Copy link

Sets the context for the message copy when it is retried.

The problem is that currently if a handler fails to process a message - it is copied, but without a context. That might result in the errors in the handler if it waits for the partition, offset or message timestamp fields in the context, which are set here

ctx = setPartitionToCtx(ctx, kafkaMsg.Partition)
ctx = setPartitionOffsetToCtx(ctx, kafkaMsg.Offset)
ctx = setMessageTimestampToCtx(ctx, kafkaMsg.Timestamp)

Context is created here and set for the original message

ctx, cancelCtx := context.WithCancel(ctx)
msg.SetContext(ctx)
defer cancelCtx()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant