Hello to all,

Well here is my issue, probably too easy for some of you, but anyhow.

I installed the MRG on a box and cumin. Everything seems to fine, and by
fine I mean I can send a message to a queue and retrieve it with Java JMS.

Now the issue is when trying to use the Topic Exchange.

Using cumin I created a new Topic Exchange and a new Queue, and a binding
between them : "usa.#" for example.

Now, I send a message to the topic which I crated, but how am I supposed to
set the routing key? Googling did not help (so far at least).

Here is my config:

java.naming.factory.initial=org.apache.qpid.jndi.PropertiesFileInitialContextFactory
connectionfactory.qpidConnectionfactory=amqp://guest:guest@clientid/test?brokerlist='tcp://locahost:5672'
destination.topicExchange = TopicExchange


 Properties properties = new Properties();
             
properties.load(this.getClass().getResourceAsStream("/topic-properties/topic.properties"));
 
              Context context = new InitialContext(properties);   

              ConnectionFactory connectionFactory = (ConnectionFactory)
context.lookup("qpidConnectionfactory");
              Connection connection = connectionFactory.createConnection();  
              connection.start(); 

              Session
session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
              Destination destination = (Destination)
context.lookup("topicExchange"); 
              

              MessageProducer messageProducer =
session.createProducer(destination); 
              MessageConsumer messageConsumer =
session.createConsumer(destination); 

              TextMessage message = session.createTextMessage("Hello world!");
              messageProducer.send(message);
              
              message.setStringProperty("x-amqp-0-10.routing-key", "usa.news");
              
              message = (TextMessage)messageConsumer.receive();    
              System.out.println(message.getText());

              connection.close();  
              context.close();


Can anyone plz suggest a way?

Thx! Eugene 

--
View this message in context: 
http://apache-qpid-developers.2158895.n2.nabble.com/AMQP-Java-JMS-Topic-Exchange-tp7112690p7112690.html
Sent from the Apache Qpid developers mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to