Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-5825

[Axis2][Tibco] Correct usage of JMS API to create MessageConsumer

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.7.4
    • 1.7.5
    • JMS transport
    • None
    • Patch

    Description

      When we tried to work with Tibco ESB we handle ClassCastException:

      java.lang.ClassCastException: com.tibco.tibjms.TibjmsxSessionImp cannot be cast to javax.jms.QueueSession
      at org.apache.axis2.transport.jms.JMSUtils.createConsumer(JMSUtils.java:434)
      

      Currently Axis2 logic based on correlation Queue (as destination) <-> QueueSession (as a session) and the same for the topics. But it's not correct. Offer rewrite method createConsumer(Session, Destination, String) to:

       public static MessageConsumer createConsumer(Session session, Destination dest, String messageSelector) throws JMSException {
              return (dest instanceof Queue ?
                      createQueueConsumer(session, (Queue)dest, messageSelector) :
                      createTopicConsumer(session, (Topic) dest, messageSelector));
          }
      
          public static MessageConsumer createQueueConsumer(Session session, Queue queue, String messageSelector) throws JMSException {
              return (session instanceof QueueSession) ?
                      ((QueueSession)session).createReceiver(queue, messageSelector) :
                      session.createConsumer(queue, messageSelector);
          }
      
          public static MessageConsumer createTopicConsumer(Session session, Topic topic, String messageSelector) throws JMSException {
              return (session instanceof TopicSession) ?
                      ((TopicSession)session).createSubscriber(topic, messageSelector, false) :
                      session.createConsumer(topic, messageSelector);
          }
      

      Attachments

        Activity

          People

            veithen Andreas Veithen
            WinZib Ziborov Egor
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: