Announcement Announcement Module
Collapse
No announcement yet.
Setting JMSReplyTo for WebSphere MQ Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Setting JMSReplyTo for WebSphere MQ

    Hi, within a Spring Batch project, I'm trying to use Spring Integration (2.0.5.RELEASE) to send a JMS message using the approach described in this blog post here:

    http://gordondickens.com/wordpress/2...ate-in-spring/

    My goal is to set the JMSReplyTo property so the receiver of the message knows where to send the response.
    The queue manager is IBM WebsphereMQ. I'm getting the following error:

    Code:
        2011-10-13 19:23:23,589 WARN  [o.s.i.j.DefaultJmsHeaderMapper:140] failed to map Message header 'JMSReplyTo' to JMS property
        javax.jms.MessageFormatException: MQJMS1058: Invalid message property name: JMSReplyTo
    I was able to set the reply-to queue before using a plain JmsTemplate. Below is the approach I'm taking, outside of the error itself, I'm wondering if there's another way to configure the replyTo queue instead of the @Header approach below.

    The interface I'm using looks like this;

    Code:
    public interface JmsGateway {
        @Gateway
        public void send(@Header("JMSReplyTo") String jmsReplyTo, String message);
    }
    If I set the value in the @Header annotation to anything that does not start with capital "JMS" (say 'jmsReplyTo'), the message gets thru fine and I can see the property.

    In a Tasklet that has an JmsGateway, I am sending the message like so:

    Code:
            jmsGateway.send("queue://MY.RESPONSE.QUEUE", message);
            // also tried: jmsGateway.send("MY.RESPONSE.QUEUE", message);
    Below is the relevant Spring config:

    Code:
        
        <si:channel id="requestChannel"/>
        <si:channel id="responseChannel"/>
    
        <si-jms:outbound-channel-adapter id="myAdapter" destination="requestQueue" channel="requestChannel" />
    
        <si:gateway id="jmsGateway"
                    service-interface="org.mycompany.JmsGateway"
                    default-request-channel="requestChannel"
                    default-reply-channel="responseChannel"/>
    
        <bean id="requestQueue" class="com.ibm.mq.jms.MQQueue">
            <constructor-arg index="0" value="MY.REQUEST.QUEUE"/>
        </bean>
    Any help would be greatly appreciated. I imagine I may not be trying to set the replyTo queue in the right place.
    Thanks!

  • #2
    Did you ever figure this out?

    Comment


    • #3
      This is a very old thread but the Spring Integration header that gets mapped to a JMSReplyTo header is called "jms_replyTo". It's available as a constant so, if you are using the technique above, it would be

      Code:
       public void send(@Header(JmsHeaders.REPLY_TO) String jmsReplyTo, String message);

      Comment


      • #4
        Ah, thanks!

        Comment

        Working...
        X