qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Godfrey <rob.j.godf...@gmail.com>
Subject Re: java jms client 0.28 destination help
Date Fri, 23 Oct 2015 22:31:51 GMT
There are others who are more expert on the addressing syntax, but the
following works for me:

connection.start();

// set up consumer
Session consumerSession = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
Queue queue =
consumerSession.createQueue("myapp_queue;{create:receiver,delete:always,node:{type:queue,x-bindings:[{exchange:'amq.match',arguments:{x-match:all,name:'dave'}}]}}");
final MessageConsumer consumer = consumerSession.createConsumer(queue);

// set up producer
Session producerSession = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
Topic topic = producerSession.createTopic("amq.match/");
final MessageProducer producer = producerSession.createProducer(topic);

// create and send the message with the appropriately set header property
TextMessage message = producerSession.createTextMessage("Hello world");
message.setStringProperty("name", "dave");
producer.send(message);

// receive the message
Message received = consumer.receive(1000l);
System.out.println(((TextMessage)received).getText());

Hope this helps,
Rob

On 23 October 2015 at 22:26, helicopterman22 <helicopterman22@btinternet.com
> wrote:

> I am using the Java JMS client (0.28) to connect to a AMQP brokers (Java
> and
> C++)
>
> In my receiver I have the following destination string which creates a
> headers queue and binds to the exchange without any problem.
>
>
> myapp_queue;{create:receiver,delete:always,node:{type:queue,x-bindings:[{exchange:'amq.match',arguments:{x-match:all,name:'dave'}}]}}
>
> However I think my senders should only need to know the exchange and the
> headers details to send messages to my exchange. I cannot workout the
> syntax
> to send to the headers exchange using my header. I have the following:
>
> exchange:'amq.match',arguments:{x-match:all,name:'dave'}
>
>
> ...but I get a JMS connection exception can anyone help please?
>
>
>
> --
> View this message in context:
> http://qpid.2158936.n2.nabble.com/java-jms-client-0-28-destination-help-tp7632825.html
> Sent from the Apache Qpid users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message