Skip to content
This repository was archived by the owner on May 7, 2025. It is now read-only.

refactor(broker): AsyncProducer function to apply options directly within the returned function #147

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

Conversation

charlieLin101274
Copy link

Description

This PR addresses an issue where the AsyncProducer function could not be used as demonstrated in the README.md example. The original implementation of AsyncProducer returned a single option function that could only apply one of the errors or successes channels, leading to incorrect behavior when both channels were provided.

Changes

  • Refactored the AsyncProducer function to apply both the errors and successes channels directly within the returned function, ensuring that both options are correctly set on the broker.Options.
  • This update ensures that the AsyncProducer function behaves as expected when used in accordance with the example provided in the README.md.

This fix allows users to properly capture both producer errors and successes when using the AsyncProducer function, improving the reliability and correctness of the Kafka broker setup.

…thin the returned function

- Modified AsyncProducer to set `errors` and `successes` channels directly within the returned function instead of returning a separate option function.
- Ensures that both channels are properly applied to the `broker.Options` when provided.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant