1

I am currently working on an application that uses Spring's JMS Messaging (JMSTemplate). The application needs to send a message to a mainframe queue that is not able to decipher the "RFH" header that the JMSTemplate appends to the message. Is there a way to entirely remove all the header information progamatically so the mainframe can just get the raw contents of the message without the header?

Here is my code...

    MQQueueConnectionFactory connectionFactory = new MQQueueConnectionFactory();
    connectionFactory.setHostName( "127.0.0.1" );
    connectionFactory.setPort( 1414 );
    connectionFactory.setChannel( "S_LOCALHOST" );
    connectionFactory.setQueueManager( "QM_LOCALHOST" );
    connectionFactory.setTransportType( 1 );

    UserCredentialsConnectionFactoryAdapter credentials = new UserCredentialsConnectionFactoryAdapter();
    credentials.setUsername( "" );
    credentials.setPassword( "" );
    credentials.setTargetConnectionFactory( connectionFactory );

    JmsTemplate jmsTemplate = new JmsTemplate( credentials );
    jmsTemplate.setPubSubDomain( false );
    jmsTemplate.setDeliveryMode( javax.jms.DeliveryMode.NON_PERSISTENT );
    jmsTemplate.setExplicitQosEnabled( true );
    jmsTemplate.setReceiveTimeout( 60000 );

    jmsTemplate.convertAndSend( "MY.QUEUE", "cobol data" );

Here is what the message looks like in the Websphere MQ Explorer. How can I remove these values? Is it even possible with Spring JMS? Lemme know if you need any more info...

enter image description here

JoshMc
  • 10,239
  • 2
  • 19
  • 38
Jason
  • 1,371
  • 4
  • 21
  • 44

1 Answers1

10

One way to disable the RFH header from being sent to a non-JMS queue is by using the targetClient queue URI property, e.g.

jmsTemplate.convertAndSend( "queue:///MY.QUEUE?targetClient=1", "cobol data" );

Alternatively, you could set this on the Queue object itself, and then use this as the destination for jmsTemplate:

queue.setTargetClient(WMQConstants.WMQ_CLIENT_NONJMS_MQ);

WebSphere MQ References:

https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.0.0/com.ibm.mq.dev.doc/q032240_.htm

http://www.ibm.com/support/knowledgecenter/SSFKSJ_9.0.0/com.ibm.mq.javadoc.doc/WMQJMSClasses/com/ibm/mq/jms/MQDestination.html

ck1
  • 5,243
  • 1
  • 21
  • 25
  • Thanks a lot ck1, your first snippet seems to have done the trick! Question about the second snippet, I've seen other posts mention setting the targetClient but I can't figure out what kind of Queue object this is, can you give me the fully qualified package name of that queue object your talking about? – Jason Jul 06 '16 at 02:41
  • Thanks, it looks useful!! – Shridutt Kothari Feb 07 '22 at 16:20
  • First snippet did the trick, Thanks! – JLumos Jun 01 '22 at 14:59