alanxz/SimpleAmqpClient

How to bind exchange and routing key to queue dynamically?

Liniaj opened this issue · 0 comments

Hi,I did not call DeclareExchange and BindQueue before receiving message in blocking mode by “Envelope::ptr_t Channel::BasicConsumeMessage(const std::string &consumer_tag)” in while(1) loop.
I want to bind different exchange and routing keys to the queue as needed elsewhere in the program. At the same time, this setting can take effect immediately in while(1) loop.In other words, I can receive the desired message immediately. What should I do?
I try to call “bool Channel::BasicConsumeMessage(const std::string &consumer_tag,Envelope::ptr_t &message, int timeout)”, set timeout=3s. Unfortunately, the binding timing may be delayed, the longest delay is 3s。This will miss the one-time message i want to receive.If timeout=0, the CPU usage will be high.
How to deal with it in order to take effect immediately?
Look forward to your reply, thank you very much.