You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by ft420 <ar...@gmail.com> on 2009/06/16 11:28:57 UTC

alternate-exchange

Hi,

  alternate-exchange option is provided in queuedeclare function where you
specify a exchange name.
 
  This option is used to route those message which are ophaned or rejected.

  I tried the option but then messages get dropped in the specified
alternate exchange instead of getting routed to that particular exchange
queue.


 Awaiting your reply.
Thanks




-- 
View this message in context: http://n2.nabble.com/alternate-exchange-tp3085324p3085324.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.


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


Re: alternate-exchange

Posted by ft420 <ar...@gmail.com>.
thanks a lot. Its working :)

Gordon Sim wrote:
> 
> ft420 wrote:
>> Hi,
>> 
>> session.exchangeDeclare(arg::exchange = "AlterExch", arg::type =
>> "direct");
>> session.queueDeclare(arg::queue = "AlterQueue", arg::exclusive=false,
>> arg::autoDelete=false);
>> session.exchangeBind(arg::exchange = "AlterExch", arg::queue =
>> "AlterQueue",
>> arg::bindingKey = "Alter_Key");
> 
> Note, this queue will only get messages whose routing-key is set to 
> "Alter-Key".
> 
>> session.queueDeclare(arg::queue = "messageQ", arg::exclusive = false,
>> arg::autoDelete = false ,
>>  arg::alternateExchange = "");
> 
> should the altenateExchange above be "AlterExch"?
> 
>> session.exchangeBind(arg::exchange = "amq.direct", arg::queue =
>> "messageQ",
>> arg::bindingKey = "routing_Key");
>>  
>> Also we have set setDiscardUnroutable(false);
>> 
>> message.getDeliveryProperties.setDiscardUnroutable(false);
>>  
>> and transfer the 10 messages to queue "messageQ"  with acceptMode
>> ACCEPT_MODE_NONE.
>> 
>> Next we delete the messageQ queue containing 10 msgs, so as per concept
>> of
>> alternate exchange these msgs should be re-routed to queue bound with the
>> alternate exchange, but its gets dropped.
> 
> The messages get routed to the alternate-exchange. They will only be 
> enqueued in queues whose bindings to that exchange match the message. 
> For a direct exchange this means that the binding key used must match 
> the routing key with which the message was first published.
> 
>> qpid-tool and qpid-config was used
>> to view the queue , alternate-exchange status and delete the queue
>> respectively.
>> 
>> deleteing  the "messageQ" if you check the status of the
>> alternate-exchange
>> it shows msgReceives 10 and msgDrops 10.
>> 
>> Just need to know where exactly are we wrong.
> 
> You need to design the exchange type and bindings for your 
> alternate-exchange to be able to handle the cases you care about.
> 
> One suggestion is to use a fanout exchange as your alternate exchange. 
> That way any message routed to that exchange will be enqueued on all 
> bound queues. This makes it easier to have a single 'dead-letter' queue 
> for example.
> 
> Hope this helps,
> 
> --Gordon.
> 
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/alternate-exchange-tp3085324p3085885.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.


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


Re: alternate-exchange

Posted by Gordon Sim <gs...@redhat.com>.
ft420 wrote:
> Hi,
> 
> session.exchangeDeclare(arg::exchange = "AlterExch", arg::type = "direct");
> session.queueDeclare(arg::queue = "AlterQueue", arg::exclusive=false,
> arg::autoDelete=false);
> session.exchangeBind(arg::exchange = "AlterExch", arg::queue = "AlterQueue",
> arg::bindingKey = "Alter_Key");

Note, this queue will only get messages whose routing-key is set to 
"Alter-Key".

> session.queueDeclare(arg::queue = "messageQ", arg::exclusive = false,
> arg::autoDelete = false ,
>  arg::alternateExchange = "");

should the altenateExchange above be "AlterExch"?

> session.exchangeBind(arg::exchange = "amq.direct", arg::queue = "messageQ",
> arg::bindingKey = "routing_Key");
>  
> Also we have set setDiscardUnroutable(false);
> 
> message.getDeliveryProperties.setDiscardUnroutable(false);
>  
> and transfer the 10 messages to queue "messageQ"  with acceptMode
> ACCEPT_MODE_NONE.
> 
> Next we delete the messageQ queue containing 10 msgs, so as per concept of
> alternate exchange these msgs should be re-routed to queue bound with the
> alternate exchange, but its gets dropped.

The messages get routed to the alternate-exchange. They will only be 
enqueued in queues whose bindings to that exchange match the message. 
For a direct exchange this means that the binding key used must match 
the routing key with which the message was first published.

> qpid-tool and qpid-config was used
> to view the queue , alternate-exchange status and delete the queue
> respectively.
> 
> deleteing  the "messageQ" if you check the status of the alternate-exchange
> it shows msgReceives 10 and msgDrops 10.
> 
> Just need to know where exactly are we wrong.

You need to design the exchange type and bindings for your 
alternate-exchange to be able to handle the cases you care about.

One suggestion is to use a fanout exchange as your alternate exchange. 
That way any message routed to that exchange will be enqueued on all 
bound queues. This makes it easier to have a single 'dead-letter' queue 
for example.

Hope this helps,

--Gordon.

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


Re: alternate-exchange

Posted by ft420 <ar...@gmail.com>.
Hi,

session.exchangeDeclare(arg::exchange = "AlterExch", arg::type = "direct");
session.queueDeclare(arg::queue = "AlterQueue", arg::exclusive=false,
arg::autoDelete=false);
session.exchangeBind(arg::exchange = "AlterExch", arg::queue = "AlterQueue",
arg::bindingKey = "Alter_Key");

session.queueDeclare(arg::queue = "messageQ", arg::exclusive = false,
arg::autoDelete = false ,
 arg::alternateExchange = "");
session.exchangeBind(arg::exchange = "amq.direct", arg::queue = "messageQ",
arg::bindingKey = "routing_Key");
 
Also we have set setDiscardUnroutable(false);

message.getDeliveryProperties.setDiscardUnroutable(false);
 
and transfer the 10 messages to queue "messageQ"  with acceptMode
ACCEPT_MODE_NONE.

Next we delete the messageQ queue containing 10 msgs, so as per concept of
alternate exchange these msgs should be re-routed to queue bound with the
alternate exchange, but its gets dropped. qpid-tool and qpid-config was used
to view the queue , alternate-exchange status and delete the queue
respectively.

deleteing  the "messageQ" if you check the status of the alternate-exchange
it shows msgReceives 10 and msgDrops 10.

Just need to know where exactly are we wrong.

Regards,



Gordon Sim wrote:
> 
> ft420 wrote:
>> Hi,
>> 
> 
> 
> 
> 
>>   alternate-exchange option is provided in queuedeclare function where
>> you
>> specify a exchange name.
>>  
>>   This option is used to route those message which are ophaned or
>> rejected.
>> 
>>   I tried the option but then messages get dropped in the specified
>> alternate exchange instead of getting routed to that particular exchange
>> queue.
> 
> I'm not clear on what the issue is here. The messages should be routed 
> to the alternate-exchange which will then enqueue them to any queue with 
> a matching binding. Could you give a bit more detail?
> 
> 
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/alternate-exchange-tp3085324p3085547.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.


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


Re: alternate-exchange

Posted by Gordon Sim <gs...@redhat.com>.
ft420 wrote:
> Hi,
> 
>   alternate-exchange option is provided in queuedeclare function where you
> specify a exchange name.
>  
>   This option is used to route those message which are ophaned or rejected.
> 
>   I tried the option but then messages get dropped in the specified
> alternate exchange instead of getting routed to that particular exchange
> queue.

I'm not clear on what the issue is here. The messages should be routed 
to the alternate-exchange which will then enqueue them to any queue with 
a matching binding. Could you give a bit more detail?


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