On 03/13/2012 11:33 AM, eugene wrote:
Hello,
So I am pretty much a newbie here with Qpid.
I have a simple question if I may, how do I use the alt-exchange in java
with AMQP/QPid?
Suppose I want to send the message to a non-existent queue (but I am
completely unaware of that), can I use the alt-exchange to "catch" all those
messages that actually have nowhere to go?
Unfortunately not. To send 'to a queue' you actually send to the
'default exchange' (an AMQP 0-10 term). The specification doesn't rule
out having an alternate exchange defined for the default exchange but it
doesn't state that it should and so at present the c++ broker at least
does not do so. That should probably be changed however.
You could define your own exchange to which messages would be sent, bind
in queues as appropriate and have an alternate exchange set for your
exchange. That way any message sent to that exchange that did not match
any queue would be re-routed through the alternate exchange where you
could arrange for it to deliver the message to a dead letter queue or
queues.
Something like that :
I have not created anything yet on the MRG side.
Queue myQueue = session.createQueue("myQueue; {create:never, delete:never,
assert: always, node:{type:queue, x-declare:{alt-exchange: DLQ_QUEUE}} }");
This does something different. This creates a queue with the alternate
exchange as defined. If the queue is deleted while still holding
messages those messages will be routed to that alternate exchange. It
won't do anything for messages that fail to reach the queue in the first
place however.
Then send a simple message.
Of course I have tried that, but all I get is :
"The name 'myQueue' supplied in the address doesn't resolve to an exchange
or a queue"
Can someone explain me then the purpose of alt-exchange?
It is largely similar in purpose to dead letter queues - i.e. a way to
handle delivery failures or orphaned messages - just not quite as simple
to explain and configure.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org