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

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

sevaorlov
Copy link
Contributor

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()

@m110
Copy link
Member

m110 commented Aug 28, 2024

Thank you @sevaorlov!

@m110 m110 merged commit 07c306d into ThreeDotsLabs:master Aug 28, 2024
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.

2 participants