[rabbitmq-discuss] Wrong result retrieving messages from 1 queue bound to 2 exchanges
Peter Larsen
pl at danskscanning.dk
Mon Nov 21 08:23:55 GMT 2011
Hello
I have a problem that is really frustrating. Can you help me?
Here is the scenario: (See codesnippets further down)
I have declared one queue "pp-queue" and is binding this queue to exchange "weblager-exchange with binding key "#.tiff.#" and to exchange "pp-exchange" with binding key "#.tif.#". Both exchanges are declared as type "topic".
Then publishing 2 messages say "wl message 1" and "wl message 2" to exchange "weblager-exchange" using routing key "wl.tiff.tiff2pdf"
and publishing 2 messages say "pp message 1" and "pp message 2" to exchange "pp-exchange" using routing key "pp.tif.cmpt" the result as follows:
consume command of queue "pp-queue" with binding to "weblager-exchange" retrieves message " wl message 1" and " pp message 1" and
consume command of queue "pp-queue" with binding to "pp-exchange" retrieves message " wl message 2" and " pp message 2".
Why does it not return the correct messages according to the binding keys?
Codesnippet - declaration of pp-queue, binding to weblager-exchange and consume - first call
$channel->basic_declare(
'pp-queue',
false,
true,
false,
false
);
$channel->queue_bind(
'pp-queue',
'weblager-exchange',
'#.tiff.#',
false,
NULL,
NULL
);
$channel->basic_qos(
null,
1,
null
);
$channel->basic_consume(
'pp-queue',
'wl',
false
false
false
false
$settings->callback // callback
);
Codesnippet - declaration of pp-queue, binding to pp-exchange and consume - second call
$channel->basic_consume(
'pp-queue',
false,
true,
false,
false
);
$channel->queue_bind(
'pp-queue',
'pp-exchange',
'#.tif.#',
false,
NULL,
NULL
);
$channel->basic_qos(
null,
1,
null
);
$channel->basic_consume(
'pp-queue',
'pp',
false
false
false
false
$settings->callback // callback
);
Codesnippet - declaration of and publishing to weblager-exchange
$channel->exchange_declare(
'weblager-exchange',
'topic',
false,
true,
false,
false,
false,
NULL,
NULL
);
$msg = new AMQPMessage(json_encode('wl.tiff.tiff2pdf'));
$channel->basic_publish(
$msg,
'weblager-exchange',
'wl.tiff.tiff2pdf',
false,
false,
NULL
);
Codesnippet - declaration of and publishing to pp-exchange
$channel->exchange_declare(
'pp-exchange',
'topic',
false,
true,
false,
false,
false,
NULL,
NULL
);
$msg = new AMQPMessage(json_encode('pp.tif.cmpt'));
$channel->basic_publish(
$msg,
'pp-exchange',
'pp.tif.cmpt',
false,
false,
NULL
);
Best regards
Dansk Scanning A/S
Peter Larsen
Senior IT-developer
E-mail: pl at danskscanning.dk
Lillebæltsvej 33
DK-6715 Esbjerg N
Phone: +45 70 114 116
Fax: +45 76 114 269
---------------------------------------------------------------------------------------------------------------------------------
This e-mail may contain confidential and/or privileged information.
If you are not the addressee or authorised to receive this for the addressee, you must not use, copy, disclose or take any action based on this e-mail or any information herein.
If you have received this e-mail in error, please advise the sender immediately and delete this e-mail. Non-compliance with this disclaimer may be subject to Legal Professional Previlege.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20111121/bc4dfa5d/attachment.htm>
More information about the rabbitmq-discuss
mailing list