Spring JMS 模板 - 删除 RFH Header 信息

Spring JMS Template - remove RFH Header information

我目前正在开发一个使用 Spring 的 JMS 消息传递 (JMSTemplate) 的应用程序。应用程序需要向大型机 queue 发送消息,但该大型机无法破译 JMSTemplate 附加到消息的 "RFH" header。有没有办法以编程方式完全删除所有 header 信息,这样大型机就可以在没有 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 甚至可能吗?让我知道您是否需要更多信息...

禁止将 RFH header 发送到 non-JMS queue 的一种方法是使用 targetClient queue URI 属性,例如

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

或者,您可以在 Queue object 本身上设置它,然后将其用作 jmsTemplate:

的目的地
queue.setTargetClient(WMQConstants.WMQ_CLIENT_NONJMS_MQ);

WebSphere MQ 参考资料:

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