Ziborov Egor created AXIS2-5825:
-----------------------------------

             Summary: [Axis2][Tibco] Corre
                 Key: AXIS2-5825
                 URL: https://issues.apache.org/jira/browse/AXIS2-5825
             Project: Axis2
          Issue Type: Bug
          Components: JMS transport
    Affects Versions: 1.7.4
            Reporter: Ziborov Egor
            Priority: Minor


When we tried to work with Tibco ESB we handle ClassCastException:
{noformat}
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)
{noformat}

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:
{code:java}
 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);
    }
{code}




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to