Skip to content

Conversation

evanh
Copy link
Member

@evanh evanh commented Jul 23, 2025

Create a new AsyncProducer that returns a Future on produce. Under the hood, the AsyncProducer is using the rdkafka::FutureProducer which uses channels to send the results from the delivery callback. This is also using the send_result function, which will error immediately if the message can't be put into the local rdkafka queue (e.g. if the queue is full).

evanh added 2 commits July 23, 2025 11:17
Using this producer allows client code to wait for the future to complete, and capture the resulting
error. Under the hood the FutureProducer creates a oneshot channel that it uses to pass the results
from the produce.
@evanh evanh marked this pull request as ready for review July 23, 2025 21:29
@evanh evanh requested review from a team as code owners July 23, 2025 21:29
@evanh evanh changed the title WIP: feat(producer): Add an AsyncProducer that returns Future feat(producer): Add an AsyncProducer that returns Future Jul 23, 2025
Copy link
Member

@untitaker untitaker left a comment

Choose a reason for hiding this comment

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

why not use it in the strategy?

@evanh
Copy link
Member Author

evanh commented Jul 24, 2025

why not use it in the strategy?

It's not clear to me that's what we want. If we do that, then anyone using the strategy will wait for their message to be flushed from the buffer, which is different from what is happening now.

@evanh evanh merged commit 60c9cf1 into main Jul 24, 2025
15 checks passed
@evanh evanh deleted the evanh/fix/future-producer branch July 24, 2025 15:04
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