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

receive no-delay msg from publisher #33

Closed
chenyujian opened this issue Oct 22, 2012 · 2 comments
Closed

receive no-delay msg from publisher #33

chenyujian opened this issue Oct 22, 2012 · 2 comments

Comments

@chenyujian
Copy link

i encounter a problem that when i received one msg,i have to proceed a long time ,so when i received the next msg,i got a delay msg published by the publisher that i don't need.
i need the no-delay msg so if the msg published too fast, some of them should be abandoned.
can anybody give me some advice?
i try the immediate flag,but it do not work,beacuse i think when my program is running, there is a consumer connected to the exchange.

while(true)
{
std::string msg;
std::string rk;
if(!this->waitforMessage(msg ,rk)){
continue;
}
sleep(2000);
}
thanks.

@alanxz
Copy link
Owner

alanxz commented Oct 22, 2012

When setting up your consumer set no_ack to false, and leave the message pre-fetch at 1 (or basic.qos = 1). This will make it so the broker will not deliver the next message until you've ack'ed the last message you consumed. This should make it so the immediate flag bounces message that aren't consumed immeidately.

FYI: the RabbitMQ guys are thinking of dropping support for the immediate flag in future versions of the broker.

@chenyujian
Copy link
Author

i follow your advice and it does work,thank you for replying.

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