You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Wayna Runa <wa...@gmail.com> on 2014/12/17 17:45:01 UTC

How to create a Destination to RabbitMQ custom exchange using qpid-client-0.30

Hi there again!

I am trying to connect to RabbitMQ queue (AMQP 0-9-1) via custom exchange
using Destination (Binding URL) without success.

I have tried several definitions of "destination", here my JNDI config:

------.------
connectionfactory.myRabbitMQConnectionFactory1 = amqp://admin:xxx@clientid
/DES_DEV?brokerlist='tcp://10.105.135.53:5672'

destination.myDestination1 = direct://ex_test1/rk_test1/q_test1
destination.myDestination2 =
direct://ex_test1//q_test1?autodelete='false'&durable='true'&internal='false'&routingkey='q_test1'
destination.myDestination3 =
direct://ex_test1//q_test1?routingkey='rk_test1'
------.------


My Java code is:

---.---.--
System.setProperty("qpid.amqp.version", "0-91");
*System.setProperty("qpid.dest_**syntax", "BURL");*
...
ConnectionFactory connectionFactory = (ConnectionFactory)
context.lookup("myRabbitMQConnectionFactory1");
Connection connection = connectionFactory.createConnection();
connection.start();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

TextMessage message = session.createTextMessage("Hello world - DESTINATION
BURL !!");
Destination destination = (Destination)
context.lookup("myJndiDirectDestination1"); // tested with 1, 2 and
Destination3
MessageProducer messageProducerD = session.createProducer(destination);

messageProducerD.send(message);
...
---.---.---

Here, my custom exchange is "ex_test1" and I have used different values for
routing keys.
I have to created previously the exchange (ex_test1) with different routing
keys, for example:

binding-a) ex_test1 ~> rk_test1 ~> q_test1
binding-b) ex_test1 ~> empty ~> q_test1
binding-c) ex_test1 ~> q_test1 ~> q_test1
binding-d) amq.direct ~> q_test1 ~> q_test1
binding-e) amq.direct ~> rk_test1 ~> q_test1

When running this code, no errors are shown, only *binding-d* and
*binding-e* work and the message is published in RabbitMQ.

They have in the header thw following:

Exchange :   amq.direct
headers:     JMS_QPID_DESTTYPE:    1


What is the correct definition of DESTINATION using custom exchange?

Thanks.


-- wr

Re: How to create a Destination to RabbitMQ custom exchange using qpid-client-0.30

Posted by Nathan Kunkee <nk...@genome.wustl.edu>.
On 12/17/2014 01:15 PM, Wayna Runa wrote:
> Thanks Nathan for your information.
>
> I tried with:
>
> destination.myDest1 = BURL:direct://ex_test1/rk_test1/
>
> .. but I have not get to publish message in RabbitMQ queue.
>
> When I use the below destinations, using *amq.direct* exchange (internal
> and default exchanges in rabbitmq), I can publish messages in the queue
> successfully.
>
> destination.myDest2 = BURL:direct://amq.direct//q_test1
>                    (publish msg w/ routingkey=q_test1)
> destination.myDest3 =
> BURL:direct://amq.direc/q_test1/q_test1                         (publish
> msg w/ routingkey=q_test1)
> destination.myDest4 =
> BURL:direct://amq.direc//q_test1?routingkey='rk_test1'    (publish msg w/
> routingkey=rk_test1)
> destination.myDest5 = BURL:direct://amq.direct//?routingkey='rk_test1'
>           (publish msg w/ routingkey=rk_test1)
>
> ...but i would try with this custom preconfigured exchange (ex_test1).
>
> any idea will be welcome.
>
> regards.
>

Hi,

Setup a loop to send about 10 messages in about 10 seconds. Watch the 
RabbitMQ management page. Do you see traffic coming into the exchange? 
Any traffic out through any queues?

AMQP is rather odd in that an exchange does not hold messages. Queues 
hold messages. So, if a message arrives at an exchange but there are no 
queues bound with the matching routing key, it drops the message. For a 
direct exchange, upon receiving a message with routing key that matches 
a binding, the message is then stored in the queue.

Hope that helps,
Nathan

____
This email message is a private communication. The information transmitted, including attachments, is intended only for the person or entity to which it is addressed and may contain confidential, privileged, and/or proprietary material. Any review, duplication, retransmission, distribution, or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is unauthorized by the sender and is prohibited. If you have received this message in error, please contact the sender immediately by return email and delete the original message from all computer systems. Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: How to create a Destination to RabbitMQ custom exchange using qpid-client-0.30

Posted by Wayna Runa <wa...@gmail.com>.
Thanks Nathan for your information.

I tried with:

destination.myDest1 = BURL:direct://ex_test1/rk_test1/

.. but I have not get to publish message in RabbitMQ queue.

When I use the below destinations, using *amq.direct* exchange (internal
and default exchanges in rabbitmq), I can publish messages in the queue
successfully.

destination.myDest2 = BURL:direct://amq.direct//q_test1
                  (publish msg w/ routingkey=q_test1)
destination.myDest3 =
BURL:direct://amq.direc/q_test1/q_test1                         (publish
msg w/ routingkey=q_test1)
destination.myDest4 =
BURL:direct://amq.direc//q_test1?routingkey='rk_test1'    (publish msg w/
routingkey=rk_test1)
destination.myDest5 = BURL:direct://amq.direct//?routingkey='rk_test1'
         (publish msg w/ routingkey=rk_test1)

...but i would try with this custom preconfigured exchange (ex_test1).

any idea will be welcome.

regards.

Re: How to create a Destination to RabbitMQ custom exchange using qpid-client-0.30

Posted by Nathan Kunkee <nk...@genome.wustl.edu>.
On 12/17/2014 10:45 AM, Wayna Runa wrote:
> Hi there again!
>
> I am trying to connect to RabbitMQ queue (AMQP 0-9-1) via custom exchange
> using Destination (Binding URL) without success.
>
> I have tried several definitions of "destination", here my JNDI config:
>
> ------.------
> connectionfactory.myRabbitMQConnectionFactory1 = amqp://admin:xxx@clientid
> /DES_DEV?brokerlist='tcp://10.105.135.53:5672'
>
> destination.myDestination1 = direct://ex_test1/rk_test1/q_test1
> destination.myDestination2 =
> direct://ex_test1//q_test1?autodelete='false'&durable='true'&internal='false'&routingkey='q_test1'
> destination.myDestination3 =
> direct://ex_test1//q_test1?routingkey='rk_test1'
> ------.------

Hi,

If you want to send to the exchange, regardless of the bound queues, 
then don't specify a queue.

destination.myDestination1 = BURL:direct://ex_text1/rk_test1/

If you specify the queue name, somewhere along the line RabbitMQ expects 
a queue of that name to be pre-bound to the exchange or it drops the 
message with an error. So the queue name shouldn't be used for sending 
messages, however, a routing key is expected (even though this isn't 
clear from any of the Qpid, RabbitMQ, or AMQP docs). The RabbitMQ web 
management interface is really helpful as it will also show you 
connections, channels, and queue consumers.

Hope that helps,
Nathan

>
>
> My Java code is:
>
> ---.---.--
> System.setProperty("qpid.amqp.version", "0-91");
> *System.setProperty("qpid.dest_**syntax", "BURL");*
> ...
> ConnectionFactory connectionFactory = (ConnectionFactory)
> context.lookup("myRabbitMQConnectionFactory1");
> Connection connection = connectionFactory.createConnection();
> connection.start();
> Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
>
> TextMessage message = session.createTextMessage("Hello world - DESTINATION
> BURL !!");
> Destination destination = (Destination)
> context.lookup("myJndiDirectDestination1"); // tested with 1, 2 and
> Destination3
> MessageProducer messageProducerD = session.createProducer(destination);
>
> messageProducerD.send(message);
> ...
> ---.---.---
>
> Here, my custom exchange is "ex_test1" and I have used different values for
> routing keys.
> I have to created previously the exchange (ex_test1) with different routing
> keys, for example:
>
> binding-a) ex_test1 ~> rk_test1 ~> q_test1
> binding-b) ex_test1 ~> empty ~> q_test1
> binding-c) ex_test1 ~> q_test1 ~> q_test1
> binding-d) amq.direct ~> q_test1 ~> q_test1
> binding-e) amq.direct ~> rk_test1 ~> q_test1
>
> When running this code, no errors are shown, only *binding-d* and
> *binding-e* work and the message is published in RabbitMQ.
>
> They have in the header thw following:
>
> Exchange :   amq.direct
> headers:     JMS_QPID_DESTTYPE:    1
>
>
> What is the correct definition of DESTINATION using custom exchange?
>
> Thanks.
>
>
> -- wr
>


____
This email message is a private communication. The information transmitted, including attachments, is intended only for the person or entity to which it is addressed and may contain confidential, privileged, and/or proprietary material. Any review, duplication, retransmission, distribution, or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is unauthorized by the sender and is prohibited. If you have received this message in error, please contact the sender immediately by return email and delete the original message from all computer systems. Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org