【问题标题】:Camel JMS object message payload converts from object to byte message while using Websphere MQCamel JMS 对象消息有效负载在使用 Websphere MQ 时从对象转换为字节消息
【发布时间】:2014-11-03 23:46:36
【问题描述】:

我正在使用 apache camel (Fuse 2.10.x) 与 http 上的肥皂和 jms 上的肥皂。 JMS 消息从 Object 消息转换为 Byte 消息格式,这会导致读取消息时出现问题。
我在 JBOSS 5.0 GA 环境中为 websphere MQ 使用 JNDI 连接。


MQConnFactory
wmq.jmsra.rar javax.jms.ConnectionFactory
xxxx
xxxxx
xxxx
xxxxx
xxxx
xxxxxx
CLIENT
JmsXARealm
1 60 10 5000


我们遇到了 IBM 属性的其他问题,这些问题已通过删除属性得到解决。我们也有骆驼头属性来设置消息




${body[0]}




${body.reqVO} != null
Object





java.lang.Exception






这适用于 http 上的肥皂。 RequestQ 获取消息作为 JMS 对象消息。但是相同的 RequestQ 通过 JMS 上的soap 中的 JMS 字节消息获取消息。 建议我的方法,我可以确保消息在所有情况下都作为对象消息接收。 注意:同样的场景适用于作为 JMS 提供者的 activeMQ。 其他技术栈:Spring 3.x、hibernate、apache cxf 等。

16:33:17,134 INFO [STDOUT] 16:33:17.133 [Camel (csCamelConfig) 线程 #8 - JmsConsumer[reqQueue]] 调试 oaccomponent.jms.JmsConfiguration - 将 JMS 消息发送到:queue://XXXXXXXXXX/REQ.QUEUE2 ?CCSID=819&encoding=1&targetClient=1 带有消息:
JMSMessage 类:jms_object
JMSType:空
JMSDeliveryMode:1
JMSExpiration: 0
JMSPriority: 0
JMSMessageID:空
JMS时间戳:0
JMSCorrelationID:空
JMSDestination:空
JMSReplyTo:空
JMSRedelivered:假
CamelJmsDeliveryMode:1
CamelJmsMessageType:对象
JMS_IBM_Character_Set:IBM437
JMS_IBM_编码:273
JMS_IBM_格式:

JMS_IBM_MsgType:8
JMS_IBM_PutApplType:28
JMS_IBM_PutDate:20140910
JMS_IBM_PutTime:15475401
面包屑 ID:ID-INN58JT4BS-53364-1410346638012-2-8
操作名称:支付
操作命名空间:http://www.xxx.com/xxxxx/xxxxx/
class com.xxx.xxxx.xxx.vo.PayloadDTO

16:33:19,465 INFO [STDOUT] 16:33:19.465 [Camel (csCamelConfig) 线程 #8 - JmsConsumer[paymJmsReqQueue]] 调试 oacamel。 processor.SendProcessor - >>>> Endpoint[direct://responseHandler] Exchange[Message: com.xxx.xxxx.base.vo.PayloadDTO@e486e6]
16:33:19,466 INFO [STDOUT] 16:33:19.466 [Camel (csCamelConfig) 线程 #8 - JmsConsumer [paymJmsReqQueue]] 信息 oacprocessor.interceptor.Tracer - ID-INN58JT4BS-53364-1410346638012-2-10 >>> (responseHandler) direct://responseHandler --> bean://responseProcessor?method=process /, org.apache.cxf.headers.Header.list=[], org.apache.cxf.message .Message.BASE_PATH=cwmq://queue:jmsReqQueue?jmsMessageType=Bytes&replyTo=msRespQueue, org.apache.cxf.message.Message.PATH_INFO=null, JMS_IBM_Format=, org.apache.camel.exchange=Exchange[JmsMessage[JmsMessageID: ID:414d5120484b49424b31533120202020318cf553bd565320]], JMSExpiration=0, JMSPriority=0, javax.xml.ws.wsdl.service={http:/impl.xxx.xxx.xxx.xx/}ServiceImplService, JMS_IBM_PutApplType=28, JMS409101, JMS_IBM_PutorgDate=2 .apache.cxf.binding.soap.SoapVersion=org.apache .cxf.binding.soap.Soap11@ab8a96, JMS_IBM_PutTime=15475401, org.apache.cxf.message.Message.ENCODING=null, org.apache.cxf.message.Message.QUERY_STRING=null, JMSXGroupID=null, JMS_IBM_Character_Set=IBM437 , HTTP.RESPONSE=null, org.apache.cxf.request.method=null, javax.xml.ws.wsdl.operation={http:/www.xxx.xxx/xxxx/xxxxx/}xxxxx, org.apache。 cxf.transport.Destination=org.apache.camel.component.cxf.transport.CamelDestination@17a840, javax.xml.ws.wsdl.description=camel://cwmq:queue:jmsReqQueue?jmsMessageType=Bytes&replyTo=jmsRespQueue?wsdl, JMS_IBM_Encoding=273, Content-Type=/, JMSXAppID=Websphere MQ Client for Java}, JMSXUserID=root , breadcrumbId=ID-INN58JT4BS-53364-1410346638012-2-8, JMS_IBM_Character_Set=IBM437, JMSExpiration= 0, JMSXDeliveryCount=1, JMSXAppID=Websphere MQ Client for Java, JMS_IBM_Format= , prequest=com.xxx.xxxx.xxxxx.PRequest@93899f, JMSTimestamp=1410364074010, JMS_IBM_PutApplType=28, org.apache.cxf.headers.Header.list =[],JMSDeliveryMode=1,JMS_IBM_Pu tDate = 20140910,JMSPriority = 0,JMSRedelivered =假,JMS_IBM_Encoding = 273,operationNamespace = http://www.xxx.xxx/xxx/xxx=xxxx,CamelJmsMessageType =对象,JMS_IBM_PutTime = 15475401,JMSMessageID按= ID:414d5120484b49424b31533120202020318cf553bd565320,JMS_IBM_MsgType = 8},体形:com.xxx.xxxxx.base .vo.PayloadDTO,正文:com.xxx.xxxx.base.vo.PayloadDTO@e486e6 16:33:19,466 INFO [STDOUT] 16:33:19.466 [Camel (csCamelConfig) 线程 #8 - JmsConsumer[paymJmsReqQueue]] 调试 oacamel.processor.SendProcessor - >>>> Endpoint[bean://responseProcessor?method=进程]交换[消息:com.scb.channels.base.vo.PayloadDTO@e486e6] JmsConsumer[reqQueue]] 调试 o.a.c.c.jms.EndpointMessageListener - Endpoint[pwmq://queue:reqQueue?concurrentConsumers=2&exchangePattern=InOnly&jmsMessageType=Object&maxConcurrentConsumers=10&maxMessagesPerTask=2] 消费者收到 JMS 消息:
JMSMessage 类:jms_bytes
JMSType:空
JMSDeliveryMode:2
JMSExpiration: 0
JMSPriority:4
JMSMessageID:ID:414d5120484b49424b31533120202020318cf553051a5420
JMS时间戳:1410364124990
JMSCorrelationID:空
JMSDestination:空
JMSReplyTo:空
JMSRedelivered:假
JMSXAppID:用于 Java 的 WebSphere MQ 客户端
JMSXDeliveryCount:1
JMSX 用户 ID:ibnkmq
JMS_IBM_Character_Set:IBM437
JMS_IBM_编码:273
JMS_IBM_格式:
JMS_IBM_MsgType:8
JMS_IBM_PutApplType:28
JMS_IBM_PutDate:20140910
JMS_IBM_PutTime:15484499
aced000573720023636f6d2e7363622e6368616e6e656c732e626173652e766f2e5061796c6f6164
44544f163e357ea7d7ff690200044c000c63757272656e7453746174657400124c6a6176612f6c61
6e672f537472696e673b4c000972657175657374564f7400214c636f6d2f7363622f6368616e6e65
6c732f626173652f766f2f42617365564f3b4c000a726573706f6e7365564f71007e00024c000974
72616365506174687400104c6a6176612f7574696c2f4c6973743b7870707372002b636f6d2e7363
622e6368616e6e656c732e626173652e766f2e42696c6c657250617952657175657374564f6aa292
32aa1e2e1f0200034c00106163636f756e74496e7175697279564f74002b4c636f6d2f7363622f63
68616e6e656c732f626173652f766f2f4163636f756e74496e7175697279564f3b4c001562696c6c
506179526567697374726174696f6e564f7400304c636f6d2f7363622f6368616e6e656c732f6261
73652f766f2f42696c6c506179526567697374726174696f6e564f3b4c001262696c6c6572506179
...


【问题讨论】:

  • 您能否更详细地解释一下消息是如何发送的? MQ JMS 不进行 JMS 对象类型转换,因此如果消息作为对象进入,则所有事物都与消息相同。
  • 我正在使用 MQ 客户端通过 JMS(Web 服务)发布 Soap 消息。消息作为数据报发送。 CXF Endpoint 在 Camel 中定义。 CXF 为我们提供了编组对象,该对象被转换为我们自己的域通用数据对象(又名 Payload)。然后将通用数据对象放入 MQ 中,由另一组域应用程序处理。
  • 通过删除 targetClient=1 属性来解决问题。这很奇怪,但解决方案有效

标签: web-services jms apache-camel ibm-mq spring-jms


【解决方案1】:

因此,通过设置 targetClient=1 意味着代码要求底层 JMS 客户端将消息作为“原始”MQ 消息发送。它没有任何 JMS 属性……只有一个 MQ 标头和有效负载。任何获取消息的应用程序都不会看到 JMS 消息。因此,JMS 客户端如果看到该消息将只能创建字节消息。

这个targetclient是在哪里配置的?我在上面的配置中没有看到。

【讨论】:

  • 我们遇到了 IBM 标头的初始问题,导致问题说明预期值应该是“java.lang.integer”而不是“java.lang.String”。不太清楚为什么骆驼用字符串属性设置它。博客和论坛中很少有使用 targetClient=1 属性的参考。它是通过 Spring 的 JndiResolver 类的扩展类设置的。请参阅上面发布的日志。它显示 targetClient=1 已设置。 将 JMS 消息发送到:queue://XXXXXXXXXX/REQ.QUEUE2?CCSID=819&encoding=1&targetClient=1 并带有消息:
  • 我看到了那个配置;至于需要添加这个的问题我不清楚;尽管我看到了其他参考资料,但目前我还不清楚这些问题。我可以确认的是,targetClient=1 的任何设置都有效地阻止了任何其他字节消息的交换。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-01-08
  • 1970-01-01
  • 2019-06-16
  • 2012-01-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多