JMS相关性ID被截断 [英] JMS Correlation ID getting truncated
问题描述
我正在将uuid字段设置为JMSCorrelationID到我的出站消息.我还设置了对Queue的答复和对Quemanger的COD答复.设置正确的用户标识符后,我可以在设置的ReplyTo Q中接收到COD消息.但是,在COD消息中收到的correlationIDID已将我的UUID字段的字节截断为32个字节.因此,我无法协调收到COD的消息.发送消息时,请找到以下代码.我已经省略了ReplyToQ和ReplytoQm部分,但是它按预期工作.
I am setting uuid field as JMSCorrelationID to my outbound message. I also set the reply to Queue and reply to Quemanger for getting COD. After setting correct user Identifier I am able to receive the COD message in the set ReplyTo Q. But the correlationID received in the COD message has truncated the bytes of my UUID field to 32 bytes. Due to this I cannot reconcile the message to which COD was received. Please find below code while sending the message. I have omitted the ReplyToQ and ReplytoQm part but it works as expected.
if(msgUuidId != null){
msg.setJMSCorrelationID(msgUuidId);
}
logger.info("Setting IBM_REPORT_COD");
msg.setIntProperty(JmsConstants.JMS_IBM_REPORT_COD, MQC.MQRO_COD);
logger.info("Setting JMS_IBM_MQMD_USERIDENTIFIER to :: "+ userid );
msg.setStringProperty(JmsConstants.JMS_IBM_MQMD_USERIDENTIFIER, userid);
我还在目标上设置了MQMD上下文
I am also setting the MQMD Context on destination
((MQDestination) destination).setTargetClient(WMQConstants.WMQ_CLIENT_NONJMS_MQ);
((JmsDestination) destination).setBooleanProperty(WMQConstants.WMQ_MQMD_READ_ENABLED, true);
((JmsDestination) destination).setBooleanProperty(WMQConstants.WMQ_MQMD_WRITE_ENABLED, true);
((MQDestination) destination).setMQMDMessageContext(WMQConstants.WMQ_MDCTX_SET_IDENTITY_CONTEXT);
在收到消息的同时,我正在阅读以下内容:.我正在使用Mule API
While receiving the message I am reading as follows:. I am using Mule API
String correlationID = (String)eventContext.getMessage().getInboundProperty("JMSCorrelationID");
所以在这里我观察到该值被截断了我设置的uuid的十六进制部分.有人可以帮我吗?
So here I am observing that the value is truncated hex portion of uuid which I had set. Can someone please help me with this?
推荐答案
Shashi's comment rang a bell. As can be read here, MQ truncates JMSCorrelationId
to 48 hex digits/24 bytes:
注释1 :MQMD CorrelId字段可以包含48个十六进制数字(24个字节)的标准WebSphere MQ Correlation ID.JMSCorrelationID可以是byte []值,包含十六进制字符并以"ID:"为前缀的字符串值,也可以是不以"ID:"开头的任意字符串值.其中的前两个代表标准的WebSphere MQ Correlation ID,并且直接映射到MQMD CorrelId字段或从中映射(直接将其映射或填充为零).他们不使用MQRFH2 jms.Cid字段.第三个(任意字符串)使用MQRFH2 jms.Cid字段;字符串的前24个字节(采用UTF-8格式)被写入MQMD CorrelID.
Note 1: The MQMD CorrelId field can hold a standard WebSphere MQ Correlation ID of 48 hexadecimal digits (24 bytes). The JMSCorrelationID can be a byte[] value, a string value containing hexadecimal characters and prefixed with "ID:", or an arbitrary string value not beginning "ID:". The first two of these represent a standard WebSphere MQ Correlation ID and map directly to or from the MQMD CorrelId field (truncated or padded with zeros as applicable); they do not use the MQRFH2 jms.Cid field. The third (arbitrary string) uses the MQRFH2 jms.Cid field; the first 24 bytes of the string, in UTF-8 format, are written into the MQMD CorrelID.
这是否与您看到的截断相关(双关语是故意的)?如果是这样,则实用的解决方案是使用24字节的相关ID.
Does that correlate (pun intended) to the truncation you're seeing? If so, the pragmatic solution would be to use a 24 byte correlation ID.
干杯
这篇关于JMS相关性ID被截断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!