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

Update receive_logs_topic.py #587

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

Conversation

gideonmandu
Copy link

Title: Issue with Shared Queue Across Multiple Subscribers

Description:

Hello Maintainers,

While using the library, I encountered an unexpected behaviour when running multiple subscriber instances with a shared queue. Specifically, when publishing a single message, only one of the subscribers receives it, even though all subscribers have similar bindings. After running the publisher multiple times, each subscriber eventually receives the message, suggesting a round-robin distribution due to the shared queue.

Steps to Reproduce:

Set up three subscriber instances with the following binding keys: "#", "kern.", and ".critical".
Run a publisher to send a message with the routing key "app.info".
Observe that only one subscriber receives the message. Running the publisher multiple times results in each subscriber eventually receiving the message.
Expected Behavior:
All subscribers with matching binding keys should receive the message on the first publish.

Actual Behavior:
Only one subscriber receives the message at a time due to the shared queue.

Proposed Solution:
After some investigation, I found that giving each subscriber instance its own unique queue (by setting exclusive=True during queue declaration and removing the queue name task_queue) resolved the issue. I've attached the modified code in this PR for reference. The code generates a new queue that is persistent as intended earlier for each instance of the script.

Would appreciate any feedback or insights into whether this is the intended behavior, and if the proposed solution aligns with the library's design principles.

Thank you for your time and consideration!

Title: Issue with Shared Queue Across Multiple Subscribers

Description:

Hello Maintainers,

While using the library, I encountered an unexpected behaviour when running multiple subscriber instances with a shared queue. Specifically, when publishing a single message, only one of the subscribers receives it, even though all subscribers have similar bindings. After running the publisher multiple times, each subscriber eventually receives the message, suggesting a round-robin distribution due to the shared queue.

Steps to Reproduce:

Set up three subscriber instances with the following binding keys: "#", "kern.*", and "*.critical".
Run a publisher to send a message with the routing key "app.info".
Observe that only one subscriber receives the message. Running the publisher multiple times results in each subscriber eventually receiving the message.
Expected Behavior:
All subscribers with matching binding keys should receive the message on the first publish.

Actual Behavior:
Only one subscriber receives the message at a time due to the shared queue.

Proposed Solution:
After some investigation, I found that giving each subscriber instance its own unique queue (by setting exclusive=True during queue declaration and removing the queue name task_queue) resolved the issue. I've attached the modified code in this PR for reference.

Would appreciate any feedback or insights into whether this is the intended behavior, and if the proposed solution aligns with the library's design principles.

Thank you for your time and consideration!
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.

1 participant