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

diference between amqp_basic_consume and amqp_basic_get #37

Closed
chenyujian opened this issue Aug 2, 2012 · 1 comment
Closed

diference between amqp_basic_consume and amqp_basic_get #37

chenyujian opened this issue Aug 2, 2012 · 1 comment

Comments

@chenyujian
Copy link

i'm confused with two apis.
ai i know, consumer will allocate a thread pool by default to listen the msg.
but according to the examples,i see while (1) instead.i think i can use amqp_basic_get to substitute amqp_basic_consum
so i want to know ,in rabbitmq-c, what's the key difference between amqp_basic_get and amqp_basic_consume.

@alanxz
Copy link
Owner

alanxz commented Aug 2, 2012

amqp_basic_get() exercises the basic.get AMQP method. Basic.get is a pull-API, meaning the client asks the broker for a single message from a queue and if the broker has a message it is delivered. For basic.get you have to continuously send the basic.get method to the broker asking for any new messages.

amqp_basic_consume() exercises the basic.consume AMQP method. Basic.consume is a push-API, meaning the client tells the broker, please send me a message when you have one for me, until I tell you to stop, the messages are delivered to the client asynchronously..

These methods are not interchangeable - they do different things.

FYI: rabbitmq-c current does not use a thread-pool to handle message delivery, everything is done on one thread.

@alanxz alanxz closed this as completed Aug 2, 2012
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

No branches or pull requests

2 participants