Reputation: 1431
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...
Upvotes: 1
Views: 6842
Reputation: 5443
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
Upvotes: 10