Announcement Announcement Module
Collapse
No announcement yet.
JMSInvokerServiceExporter & JMS 1.0.2 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JMSInvokerServiceExporter & JMS 1.0.2

    Hi,

    I was trying Spring JMS Remoting using JMS 1.0.2 and i observed that JMSInvokerClientInterceptor supports sending messaging with JMS1.0.2 but the JMSInvokerServiceExporter does not. When the response had to be sent back, i would get a :

    Code:
    java.lang.AbstractMethodError: com.ibm.mq.jms.MQQueueSession.createProducer(Ljavax/jms/Destination;)Ljavax/jms/MessageProducer;
    Digging deeper into the source I saw that JMSInvokerServiceExporter.writeRemoteInvocationRes ult only supported MessageProducer unlike the JMSInvokerClientInterceptor which supported QueueSender. To overcome this I did override the writeRemoteInvocationResult method in my class to:

    Code:
    /**
    	 * Send the given RemoteInvocationResult as a JMS message to the originator.
    	 * @param requestMessage current request message
    	 * @param session the JMS Session to use
    	 * @param result the RemoteInvocationResult object
    	 * @throws javax.jms.JMSException if thrown by trying to send the message
    	 */
    	protected void writeRemoteInvocationResult(
    			Message requestMessage,
                Session session, RemoteInvocationResult result) throws JMSException {
    
            Message response = createResponseMessage(requestMessage, session,
                    result);
            try {
                if (session instanceof QueueSession) {
                    // Perform all calls on QueueSession reference for JMS 1.0.2
                    // compatibility...
                    Destination dest = requestMessage.getJMSReplyTo();
                    Queue replyTo = (Queue) dest;
                    QueueSession queueSession = (QueueSession) session;
                    QueueSender sender = queueSession.createSender(replyTo);
                    sender.send(response);
                } else {
                    MessageProducer producer = session
                            .createProducer(requestMessage.getJMSReplyTo());
                    producer.send(response);
                }
            }finally {
                JmsUtils.closeMessageProducer(null);
            }
        }
    Is this right way to go about the problem? If yes, then this patch should be applied to the spring framework itself. Please advice.
Working...
X