|
Joined: 05 Oct 2011
Posts: 1
|
Hello
I have a problem that is really frustrating. Can anyone 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?
All codesnippets are written in PHP.
Codesnippet - declaration of pp-queue, binding to weblager-exchange and consume - first call
Code: $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
Code: $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
Code: $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
Code: $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
);
|
|
|