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

Reply via email to