[openamq-dev] Help on OpenAMQ (fanout exchange type) required
Martin Sustrik
sustrik at imatix.com
Tue Aug 21 15:42:22 CEST 2007
Hi Mousami,
There are several problems with your code.
1.) You are trying to bind your queue to an exchange with no name ("").
This is not allowed. What you want to do is to bind your queue to
"amq.fanout" exchange. BTW, when using fanout exchange, there's no point
in setting routing key as it is ignored by fanout matching algorithm.
Maybe you would like to read AMQP specs to understand how exchanges,
queues & bindings are supposed to work:
http://www.amqp.org/tikiwiki/tiki-download_file.php?fileId=6
2.) If you use amq_client_session_wait with a timout, you should take
into account that no message may arrive within the time interval
specified, the function will terminate because of timeout and subsequent
call to amq_client_session_get_basic_arrived_count will return 0 and
amq_client_session_basic_arrived will return NULL. If you want infinite
timout use 0 as the timeout value.
3.) Following code will obviosly read all messages available and end
with content==NULL (creating memory leaks as messages weren't destructed
properly):
content = amq_client_session_basic_arrived (session);
while (content) {
// process content
content = amq_client_session_basic_arrived (session);
}
Martin
More information about the openamq-dev
mailing list