从 WAS Liberty 读取消息并将消息写入 MQ

Reading and writing messages into MQ from WAS Liberty

我们尝试使用 JMS 模板发送 MAP (java.util),但在客户端我们无法读取消息,并且在服务器启动期间,spring boot @JMSListener 抱怨对于以下消息,这适用于 WAS 7 但不适用于 WAS Liberty 8.5.5,我还包括代码片段以及我们为不同版本的服务器接收的不同消息格式。 WAS Liberty 有什么变化吗?

是自由 - 7 -

at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:116) ~[spring-messaging-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
2019-07-05T13:07:14.357-05:00 [APP/PROC/WEB/0] [OUT] at org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:114) ~[spring-jms-5.1.3.RELEASE.jar!/:5.1.3.RELEASE]
2019-07-05T13:07:14.357-05:00 [APP/PROC/WEB/0] [OUT] ... 10 common frames omitted
2019-07-05T13:07:14.393-05:00 [APP/PROC/WEB/0] [OUT] 2019-07-05 18:07:14.370 WARN 20 --- [enerContainer-1] o.s.j.l.DefaultMessageListenerContainer : Execution of JMS message listener failed, and no ErrorHandler has been set.
2019-07-05T13:07:14.394-05:00 [APP/PROC/WEB/0] [OUT] org.springframework.jms.listener.adapter.ListenerExecutionFailedException: Listener method 'public void com.aa.amps.base.task.finalize.BaseBowUpdateListener.receiveMessage(javax.jms.MapMessage)' threw exception; nested exception is org.springframework.jms.support.converter.MessageConversionException: Could not find type id property [_type] on message [ID:414d51204d454d5154433120202020205ccc4b2725acdc4c] from destination [null]

消息是 MAP

 jmsTemplate.convertAndSend(destination, message, new MessagePostProcessor() {
                    @Override
                    public Message postProcessMessage(Message message) throws JMSException {
                        message.setJMSReplyTo(null);
                        LOGGER.info("In BaseBowUpdateSender - send() message to AMPS-BASE QUEUE : {} ", message);
                        return message;
                    }
                });

WAS - LIBERTY 消息格式

JMSMessage class: jms_text
  JMSType:          null
  JMSDeliveryMode:  2
  JMSDeliveryDelay: 0
  JMSDeliveryTime:  0
  JMSExpiration:    0
  JMSPriority:      4
  JMSMessageID:     ID:414d51204d454d5154433120202020205ccc4b272634ce4d
  JMSTimestamp:     1562784513140
  JMSCorrelationID: null
  JMSDestination:   null
  JMSReplyTo:       null
  JMSRedelivered:   true
    JMSXAppID: jar                         
    JMSXDeliveryCount: 193
    JMSXUserID: apmqstc     
    JMS_IBM_Character_Set: UTF-8
    JMS_IBM_Encoding: 273
    JMS_IBM_Format: MQSTR   
    JMS_IBM_MsgType: 8
    JMS_IBM_PutApplType: 28
    JMS_IBM_PutDate: 20190710
    JMS_IBM_PutTime: 18483314
<map><elt name="trackType">03</elt><elt name="lastDefferDate">07/10/2019</elt><elt name="packageDesc ...

下面是预期消息

JMSMessage class: jms_map
  JMSType:          null
  JMSDeliveryMode:  2
  JMSDeliveryDelay: 0
  JMSDeliveryTime:  0
  JMSExpiration:    0
  JMSPriority:      4
  JMSMessageID:     ID:414d51204d454d5154433120202020205ccc4b272634404a
  JMSTimestamp:     1562783439854
  JMSCorrelationID: null
  JMSDestination:   queue://- INFO IS THERE 
  JMSReplyTo:       null
  JMSRedelivered:   false
    JMSXAppID: WebSphere MQ Client for Java
    JMSXDeliveryCount: 1
    JMSXUserID: apmqstc     
    JMS_IBM_Character_Set: UTF-8
    JMS_IBM_Encoding: 273
    JMS_IBM_Format: MQSTR   
    JMS_IBM_MsgType: 8
    JMS_IBM_PutApplType: 28
    JMS_IBM_PutDate: 20190710
    JMS_IBM_PutTime: 18303986

我的应用程序(JMS 应用程序)正在将 WebSphere MQ 消息放入 queue。这些消息将由 jms 应用程序获取。我误解了可用的 targetClientId 选项,认为如果我们写入的消息是 MQ,则 targetClientId 需要被提及为 "mq" 但事实并非如此。只有当我们处理消息时,我们才需要将 targetClientId 设置为 MQ non-jms 申请。当我将 targetClientId 设置为 'MQ' 时,它会剥离 JMS 应用程序处理消息所需的 RFH headers,并且在消费应用程序中解析失败。

        <jmsQueue id="MYAPP_QUEUE" jndiName="jms/test/testq">
            <properties.wmqJms 
                baseQueueName="MYAPP.TEST.A" 
                persistence="PERS" 
                targetClient="MQ"/> -- removed this 
        </jmsQueue>