• Type: New Feature New Feature
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0
    • Fix Version/s: None
    • Labels:


      JMS topics and queues both have names that are accessible with getTopicName() and getQueueName(), but for applications where the type of destination (topic or queue) is configurable - which I would consider a good application - it's difficult to get the actual destination's name.

      An ugly typecast or something similar must be used:

        public static String getJMSDestinationName(Message msg) throws JMSException
          Destination origDest = msg.getJMSDestination();
          if( origDest==null ) return null;
          if( origDest instanceof Topic) {
            return ((Topic)origDest).getTopicName();
          else {
            return ((Queue)origDest).getQueueName();

      What I'm proposing is simply a common Destination.getName() method so this code becomes nicer:

        public static String getJMSDestinationName(Message msg) throws JMSException
          return msg.getJMSDestination().getName();

      The implementation of Destination.getName() is trivial for Topic and Queue.

      I can understand the objection of saying: "'Destination' is just a marker interface and JMS abstracts from the actual topic/queue name, these names shouldn't matter."

      But then, why is there getQueueName()/getTopicName() in the first place?

      I find this name very useful in order to debug or sort message streams into buckets and it would be nice if this name will be simpler to get by.


        No work has yet been logged on this issue.


          • Assignee:
          • Votes:
            0 Vote for this issue
            1 Start watching this issue


            • Created: