Not seeing message properties that I set explicitly (Spring/JMS/MQ)

房东的猫 提交于 2019-12-07 14:29:51

问题


Two separate processes are communicating via JMS over MQ.

The writer sets a string property:

new MessageAction() {
    public void actOn(Message message) throws JMSException {
        logger.debug("Setting message property (GmmThreadId, CASHFLOW-1234)");
        message.setStringProperty("GmmThreadId", "CASHFLOW-1234");
    }
});

This MessageAction is executed, as shown in the logs:

Setting message property (GmmThreadId, CASHFLOW-1234)


The reader uses a message selector to obtain this message. (using Spring's JmsTemplate v1 - an old version I know, but it's baked into our vendor's framework and we're compelled to use it.)

template.receiveSelected(queue, "GmmThreadId = 'CASHFLOW-1234' or GmmThreadId IS NULL");

The only messages on the queue are ones for which the logs show that the writer set the message property. In the logs for the reader, I enumerate the properties and also try to log the value of GmmThreadId. It also shows that the property GmmThreadId does not exist.

message property JMS_IBM_PutDate = 20111003
message property JMSXAppID = WebSphere MQ Client for Java
message property JMS_IBM_Format = MQSTR
message property JMS_IBM_PutApplType = 28
message property JMS_IBM_MsgType = 8
message property JMSXUserID = MUSR_MQADMIN
message property JMS_IBM_PutTime = 23551798
message property JMSXDeliveryCount = 2
message had GmmThreadId property of null

Note, if my message selector is only "GmmThreadId = 'CASHFLOW-1234'" then nothing is dequeued.

Using WebSphere MQ Explorer to view the message, I cannot find anywhere to view the application set message properties. The message type is MQSTR, if that makes any difference.

Both reader and writer applications are running in WebSphere v6.

Where am I going wrong?


回答1:


As indicated by this thread the message properties will be suppressed if the destination type is 'MQ'. For me, this is configured in the WebSphere App Server console. I changed the queue type to 'JMS' and the message properties were persisted.



来源:https://stackoverflow.com/questions/7642206/not-seeing-message-properties-that-i-set-explicitly-spring-jms-mq

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!