我目前正在使用Spring的JMS消息传递(JMSTemplate)的应用程序上工作。应用程序需要将消息发送到大型机队列,该大型机队列无法破译JMSTemplate附加到消息的“ RFH”头。有没有一种方法可以通过编程方式完全删除所有标头信息,以便大型机只获取没有标头的消息的原始内容?
这是我的代码...
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" );
Run Code Online (Sandbox Code Playgroud)
这是该消息在Websphere MQ Explorer中的外观。如何删除这些值?Spring JMS甚至可能吗?Lemme知道您是否需要更多信息...
禁止将RFH标头发送到非JMS队列的一种方法是使用targetClient队列URI属性,例如
jmsTemplate.convertAndSend( "queue:///MY.QUEUE?targetClient=1", "cobol data" );
Run Code Online (Sandbox Code Playgroud)
另外,您可以在Queue对象本身上进行设置,然后将其用作目标jmsTemplate:
queue.setTargetClient(WMQConstants.WMQ_CLIENT_NONJMS_MQ);
Run Code Online (Sandbox Code Playgroud)
WebSphere MQ参考:
https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.0.0/com.ibm.mq.dev.doc/q032240_.htm
| 归档时间: |
|
| 查看次数: |
2207 次 |
| 最近记录: |