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

Allow calling heartbeat from eachMessage handler #1255

Merged
merged 4 commits into from
Dec 27, 2021

Conversation

julienvincent
Copy link
Contributor

This is a small improvement for a pain-point I have had for a while where I have often had to 'eject' out to an eachBatch handler just to gain access to the heartbeat function.

Sometimes consumers have to do a lot of work for individual messages in a topic and in these scenarios it makes sense to have access to the heartbeat function to avoid the session timeout and keep the consumer alive.

Comment on lines +886 to +887
export type EachBatchHandler = (payload: EachBatchPayload) => Promise<void>
export type EachMessageHandler = (payload: EachMessagePayload) => Promise<void>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've explicitly exported these two types to allow using them in utils and libraries (another small pain-point of mine :)

@Nevon
Copy link
Collaborator

Nevon commented Dec 17, 2021

Could you please write a test that makes use of this? It's pretty simple, but it's more to prevent regression. It would also be good if you could update the docs with the new property.

@julienvincent
Copy link
Contributor Author

Will do. Also need to get the existing tests to pass

@julienvincent
Copy link
Contributor Author

@Nevon That should do it. Let me know if anything else is required

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