qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robbie Gemmell" <robbie.gemm...@gmail.com>
Subject RE: getJMSDestimation
Date Tue, 15 Dec 2009 13:42:21 GMT
Hi Brant,

You appear to have run into this issue:
https://issues.apache.org/jira/browse/QPID-2242

It has been resolved on trunk, and so will go out in the upcoming 0.6
release.

Robbie

> -----Original Message-----
> From: Brant Boehmann [mailto:brant.boehmann@gmail.com]
> Sent: 15 December 2009 13:23
> To: users@qpid.apache.org
> Subject: getJMSDestimation
> 
> I'm trying to utilize the qpid java client using only JMS classes (not
> AMQP
> or QPID classes). However the Message.getJMSDestination() always
> returns
> null. Note I'm using the C++ broker.
> 
> I am subscribing to messages like so:
> Topic topic = _session.createTopic("#");
> TopicSubscriber messageSubscriber = _session.createSubscriber(topic);
> messageSubscriber.setMessageListener(new MyMessageListener());
> 
> So my listener is receiving messages from multiple topics. When that
> message
> is received, I'd like to know what topic it was sent to.
> 
> Here's what I'm trying:
> 
> public void onMessage(Message message) {
>    try {
>       BytesMessage bytes = (BytesMessage) message;
>       String routingKey = null;
>       Topic topic =  (Topic)message.getJMSDestination();
>       if(topic != null) {
>          routingKey = topic.getTopicName();
>       }
>      System.out.println("Routing Key: " + routingKey);
>   } catch(JMSException ex) {
>      ex.printStackTrace();
>   }
> }
> 
> 
> Unfortunately, message.getJMSDestination() always returns null for me.
> 
> I can get it to work this way, but again I don't want to tie my code to
> qpid
> specific classes:
> 
> public void onMessage(Message message) {
>   JMSBytesMessage qpidbytes = (JMSBytesMessage) message;
>   AMQMessageDelegate_0_10 delegate = (AMQMessageDelegate_0_10)
> qpidbytes.getDelegate();
>   String routingKey = delegate.getDeliveryProperties().getRoutingKey();
>   System.out.println("Routing Key: " + routingKey);
> }
> 
> 
> 
> I even tried explicitly setting the JMSDestination when publishing the
> message, but that doesn't seem to make any difference. Why does
> getJMSDestination() always return null? Is there a workaround for me?
> 
> Thanks in advance


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


Mime
View raw message