Spring JMS模板-删除RFH标头信息 [英] Spring JMS Template - remove RFH Header information
问题描述
我目前正在使用Spring的JMS消息传递(JMSTemplate)的应用程序上工作.应用程序需要将消息发送到大型机队列,该大型机队列无法破译JMSTemplate附加到消息的"RFH"头.有没有一种方法可以通过编程方式完全删除所有标头信息,以便大型机只获取没有标头的消息的原始内容?
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?
这是我的代码...
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" );
这是Websphere MQ Explorer中消息的外观.如何删除这些值? Spring JMS甚至可能吗? Lemme知道您是否需要更多信息...
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...
推荐答案
一种禁止将RFH标头发送到非JMS队列的方法是使用targetClient
队列URI属性,例如
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" );
或者,您可以在Queue
对象本身上进行设置,然后将其用作jmsTemplate
的目标:
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参考:
WebSphere MQ References:
https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.0.0/com.ibm.mq.dev.doc/q032240_.htm
这篇关于Spring JMS模板-删除RFH标头信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!