Skip to content

Help with basic_consumer_threaded.py example #1429

Closed Answered by lukebakken
albertkohl-monotek asked this question in Q&A
Discussion options

You must be logged in to vote

Yep, you just need to set the prefetch and that will set a maximum number of un-acked messages sent to your client. Once a thread acks a message, RabbitMQ will send a new one and a new thread will be started.

If you're interested, I ran some formatting on your code in my fork - https://github.com/lukebakken/pika-1429/tree/lukebakken/pika-1429. I also checked in the Pipfile.lock file.

Anyway, the thread handling code is pretty basic in the example as the list of threads isn't cleaned up when a thread completes. That could be replaced with a dict, for instance.

Thanks for using Pika and RabbitMQ.

Replies: 6 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@lukebakken
Comment options

Answer selected by albertkohl-monotek
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@lukebakken
Comment options

Comment options

You must be logged in to vote
1 reply
@lukebakken
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants