qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gordon Sim <g...@redhat.com>
Subject Re: Redeliver Queued Messages to Exchange via Custom Exchange
Date Tue, 26 Jan 2010 11:50:15 GMT
On 01/20/2010 03:18 PM, Andrew L wrote:
> I am writing a custom exchange for qpid.  It attempts to deliver
> messages in a specific way, and if it fails, the messages are stored
> in a "holding" queue.  After some state changes, the exchange needs
> to try to redeliver the held messages.  How is this best implemented
> within the custom exchange?

I wouldn't advise this strategy. There are no guarantees around any API 
for custom exchanges so that route will likely lead to a lot of 
maintenance on your part.

You can define an alternate exchange for an exchange. If messages aren't 
routed to one or more queues by the primary exchange then they will be 
routed to the alternate exchange and from there perhaps into any 
matching queue.

You can then also specify an alternate-exchange for a queue. When a 
queue is deleted, any messages on it at that time will be routed through 
the alternate exchange.

So one (perhaps a little clumsy) method of achieving what you want would 
be to use a dead-letter exchange (lets call it dle) of type fanout. You 
would set the alternate exchange of your 'real' exchange (lets call that 
my-exchange) to be dle and you would bind a queue (dlq) to dle to hold 
all the unroutable messages.

You would then have to create a temporary queue (dummy-q) whose 
alternate-exchange was set to be my-exchange, move the messages from dlq 
to dummy-q (using the QMF move command), then delete dummy-q, causing 
all those messages to be re-routed through the original my-exchange. 
(This last part could be done by a simple script that you ran via cron 
or similar).

> I am looking for something similar to the Queue::move method.  The
> exception being I would like to move the messages from a queue to an
> exchange for routing (and not directly into another queue).  I also
> do not want to implement this via an external client which consumes
> messages in the holding queue and sends them back to the exchange
> (although, that will be the solution if it is impossible from within
> the exchange).

The above solution does involved an external client, but doesn't require 
the messages to all be routed through it. The client merely triggers 
internal re-routing periodically.

Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org

View raw message