没有看到我显式设置的消息属性(Spring/JMS/MQ)

发布于 2024-12-07 18:25:12 字数 1386 浏览 1 评论 0原文

两个独立的进程通过 JMS over MQ 进行通信。

编写者设置一个字符串属性:

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

执行此MessageAction,如日志所示:

Setting message property (GmmThreadId, CASHFLOW-1234)


阅读者使用消息选择器来获取这条消息。 (使用 Spring 的 JmsTemplate v1 - 我知道的一个旧版本,但它已融入我们供应商的框架中,我们被迫使用它。

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

队列中唯一的消息是日志显示编写者设置了消息属性的消息。在读者的日志中,我枚举了属性并尝试记录 GmmThreadId 的值。它还表明属性 GmmThreadId 不存在。

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

请注意,如果我的消息选择器仅为 "GmmThreadId = 'CASHFLOW-1234'",则不会出列任何内容。

使用WebSphere MQ Explorer查看消息,我找不到任何地方可以查看应用程序集消息属性。消息类型是 MQSTR(如果有什么区别的话)。

读取器和写入器应用程序都在 WebSphere v6 中运行。

我哪里错了?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

走野 2024-12-14 18:25:12

此线程所示,如果目标类型是“MQ”。对于我来说,这是在 WebSphere App Server 控制台中配置的。我将队列类型更改为“JMS”,并且消息属性被保留。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文