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

Multi-topic publishing #69

Merged
merged 5 commits into from
Jun 10, 2024
Merged

Multi-topic publishing #69

merged 5 commits into from
Jun 10, 2024

Conversation

cnweaver
Copy link
Collaborator

This patch makes setting a single topic for a Producer object optional, and enables the target topic to be specified when write() is called, so that one Producer can publish to multiple topics. Users who want the convenience of not having to specify the topic for each message when sending to only a single topic can use the interface unchanged, but this enables much improved efficiency for users who need to publish to multiple topics over having to create multiple Producers (with a significant overhead in background threads and file descriptors). As currently implemented, the new logic is also lenient, such that even a Producer constructed with a specified topic will still allow the topic to be overridden on individual write() calls, if the user so chooses.

@cnweaver cnweaver added the enhancement New feature or request label May 24, 2024
@cnweaver cnweaver self-assigned this May 24, 2024
Append the name of the target topic to error messages when it may be relevant.
This latter feature uses a hard-coded list of error codes, which is not ideal, but seems tolerable, as this only affects the exception error message, is never technically wrong (since the error arose from a message being sent to the referenced topic), the full information is always available though the `error` and `message` subobjects, and the set of relevant errors changes infrequently.
Copy link

@jnation3406 jnation3406 left a comment

Choose a reason for hiding this comment

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

Looks good to me

adc/producer.py Outdated Show resolved Hide resolved
@cnweaver cnweaver merged commit b1a5a81 into master Jun 10, 2024
1 of 4 checks passed
@cnweaver cnweaver deleted the multi-topic-publishing branch June 10, 2024 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants