เพย์โหลดข้อความอ็อบเจ็กต์ Camel JMS แปลงจากอ็อบเจ็กต์เป็นข้อความไบต์ขณะใช้ Websphere MQ

ฉันใช้ apache Camel (Fuse 2.10.x) กับ Soap บน http และ Soap บน jms ข้อความ JMS จะถูกแปลงจากข้อความ Object เป็นรูปแบบข้อความ Byte ซึ่งทำให้เกิดปัญหาในการอ่านข้อความ
ฉันกำลังใช้การเชื่อมต่อ JNDI สำหรับ websphere MQ ในสภาพแวดล้อม JBOSS 5.0 GA

<tx-connection-factory>
<jndi-name>MQConnFactory <xa-transaction />
<rar-name>wmq.jmsra.rar <connection-definition>javax.jms.ConnectionFactory</connection-definition>
< <config-property name="channel" type="java.lang.String">xxxx</config-property>
<config-property name="hostName" type="java.lang.String">xxxxx</config-property>
<config-property name="port" type="java.lang.String">xxxx</config-property>
<config-property name="username" type="java.lang.String">xxxxx</config-property>
<config-property name="password" type="java.lang.String">xxxx</config-property>
<config-property name="queueManager" type="java.lang.String">xxxxxx</config-property>
<config-property name="transportType" type="java.lang.Integer">CLIENT</config-property>
<security-domain-and-application>JmsXARealm</security-domain-and-application>
<min-pool-size>1 <max-pool-size>60 <idle-timeout-minutes>10 <blocking-timeout-millis>5000 </tx-connection-factory>


We faced someother problem with IBM attributes which were resolved by removing the attributes. Also we have camel header attribute to set the message

<route id="myrouteName"> 
<from uri="direct:myrouteName"></from>
<setHeader headerName="prequest">
<simple>${body[0]}</simple>
</setHeader>
<doTry>
<to uri="bean:myWrapService?method=mymethod" />
<filter>
<simple>${body.reqVO} != null</simple>
<setHeader headerName="CamelJmsMessageType"> <constant>Object</constant></setHeader>
<to uri="{{requestQ}}" pattern="InOnly" />
</filter>
<to uri="direct:responseHandler" />
<to uri="bean:responseService?method=myMethod"/>
<doCatch>
<exception>java.lang.Exception</exception>
<to uri="bean:exceptionHandler?method=process" />
<to uri="bean:responseService?method=myMethod" />
</doCatch>
</doTry>
</route>

This works fine with soap over http. RequestQ get messages as JMS object message. But same RequestQ get message by JMS Byte Message in soap over JMS. Suggest me approach which I can ensure that message recieved as Object message in all scenario. Note: Same scenario works fine with activeMQ as JMS provider. Other Tech Stack: Spring 3.x, hibernate, apache cxf and etc.

16:33:17,134 INFO [STDOUT] 16:33:17.133 [Camel (csCamelConfig) thread #8 - JmsConsumer[reqQueue]] DEBUG o.a.c.component.jms.JmsConfiguration - Sending JMS message to: queue://XXXXXXXXXX/REQ.QUEUE2?CCSID=819&encoding=1&targetClient=1 with message:
JMSMessage class: jms_object
JMSType: null
JMSDeliveryMode: 1
JMSExpiration: 0
JMSPriority: 0
JMSMessageID: null
JMSTimestamp: 0
JMSCorrelationID: null
JMSDestination: null
JMSReplyTo: null
JMSRedelivered: false
CamelJmsDeliveryMode: 1
CamelJmsMessageType: Object
JMS_IBM_Character_Set: IBM437
JMS_IBM_Encoding: 273
JMS_IBM_Format:

JMS_IBM_MsgType: 8
JMS_IBM_PutApplType: 28
JMS_IBM_PutDate: 20140910
JMS_IBM_PutTime: 15475401
breadcrumbId: ID-INN58JT4BS-53364-1410346638012-2-8
operationName: pay
operationNamespace: http:/www.xxx.com/xxxxx/xxxxx/
class com.xxx.xxxx.xxx.vo.PayloadDTO

ดังนั้นโดยการตั้งค่า targetClient=1 หมายความว่าโค้ดกำลังขอให้ไคลเอ็นต์ JMS พื้นฐานส่งข้อความเป็นข้อความ MQ 'ดิบ' มันจะไม่มีคุณสมบัติ JMS ใดๆ... แค่ส่วนหัว MQ และเพย์โหลด แอปพลิเคชันใดๆ ที่ได้รับข้อความจะไม่เห็นข้อความ JMS ดังนั้นไคลเอ็นต์ JMS หากเห็นข้อความจะสามารถสร้างข้อความไบต์ได้เท่านั้น


person Balakumar Narayanasamy    schedule 10.09.2014    source แหล่งที่มา
comment
ฉันกำลังโพสต์ข้อความ Soap บน JMS (บริการเว็บ) โดยใช้ไคลเอนต์ MQ ข้อความถูกส่งเป็นดาต้าแกรม CXF Endpoint ถูกกำหนดไว้ใน Camel CXF ให้วัตถุที่จัดเรียงไว้แก่เราซึ่งจะถูกแปลงเป็นวัตถุข้อมูลสากลของโดเมนของเราเอง (หรือที่เรียกว่า Payload) จากนั้นออบเจ็กต์ข้อมูลสากลจะถูกทิ้งใน MQ ซึ่งถูกประมวลผลโดยแอปพลิเคชันโดเมนชุดอื่น   -  person Calanais    schedule 10.09.2014
comment
จัดการเพื่อแก้ไขปัญหาโดยการลบแอตทริบิวต์ targetClient=1 มันแปลกแต่วิธีแก้ปัญหาได้ผล   -  person Balakumar Narayanasamy    schedule 10.09.2014
comment
เรามีปัญหาเบื้องต้นเกี่ยวกับส่วนหัวของ IBM ทำให้เกิดปัญหาในการระบุค่าที่คาดหวังควรเป็น 'java.lang.integer' แทนที่จะเป็น 'java.lang.String' ไม่แน่ใจเหมือนกันว่าทำไมอูฐจึงตั้งค่าด้วยแอตทริบิวต์สตริง มีการอ้างอิงเพียงเล็กน้อยในบล็อกและฟอรัมเพื่อใช้แอตทริบิวต์ targetClient=1 มันถูกตั้งค่าผ่านคลาสขยายของคลาส JndiResolver ของ Spring โปรดดูบันทึกที่โพสต์ด้านบน มันแสดงว่า targetClient=1 ถูกตั้งค่าไว้ กำลังส่งข้อความ JMS ไปที่: Queue://XXXXXXXXX/REQ.QUEUE2?CCSID=819&encoding=1&targetClient=1 พร้อมข้อความ:   -  person Balakumar Narayanasamy    schedule 10.09.2014


คำตอบ (1)


Targetclient นี้อยู่ที่ไหนถูกกำหนดค่าไว้? ฉันไม่เห็นในการกำหนดค่าด้านบน

คุณช่วยอธิบายรายละเอียดเพิ่มเติมได้ไหมว่าข้อความถูกส่งไปอย่างไร MQ JMS จะไม่ทำการแปลงประเภทอ็อบเจ็กต์ JMS ดังนั้นทุกสิ่งที่เท่ากันกับข้อความหากเข้าไปเป็นข้อความอ็อบเจ็กต์ควรออกมาเป็นหนึ่งเดียว

person Calanais    schedule 10.09.2014
comment
ฉันเห็นการกำหนดค่านั้น สำหรับปัญหาที่ต้องเพิ่มสิ่งนี้ฉันไม่ชัดเจน แม้ว่าฉันจะเห็นการอ้างอิงอื่น ๆ แต่ในขณะนี้ยังไม่ชัดเจนสำหรับฉันในประเด็นต่างๆ สิ่งที่ฉันสามารถยืนยันได้คือการตั้งค่าใด ๆ ของ targetClient=1 จะป้องกันการแลกเปลี่ยนข้อความไบต์อื่น ๆ ได้อย่างมีประสิทธิภาพ - person Balakumar Narayanasamy; 10.09.2014
comment
16:33:19,465 ข้อมูล [STDOUT] 16:33:19.465 [Camel (csCamelConfig) เธรด # 8 - JmsConsumer [paymJmsReqQueue]] DEBUG o.a.camel.processor.SendProcessor - >>>> จุดสิ้นสุด [direct://responseHandler] แลกเปลี่ยน [ ข้อความ: com.xxx.xxxx.base.vo.PayloadDTO@e486e6]
16:33:19,466 INFO [STDOUT] 16:33:19.466 [Camel (csCamelConfig) thread #8 - JmsConsumer[paymJmsReqQueue]] INFO o.a.c.processor .interceptor.Tracer - ID-INN58JT4BS-53364-1410346638012-2-10 >>> (responseHandler) direct://responseHandler --> bean://responseProcessor?method=process ‹‹‹ รูปแบบ: InOut, ส่วนหัว: {CamelCxfMessage ={javax.xml.ws.wsdl.port={http://impl.xxxx.xxxx.xxx.com/}ServiceImplPort, JMSCorrelationID=null, JMSMessageID=ID:414d5120484b49424b31533120202020318cf553bd565320, org.apache.cxf.service.model.Message ข้อมูล =[อินพุต MessageInfo: {http://www.xxx.com/xxxxx/xxxx/}xxxx], JMSDeliveryMode=1, org.apache.cxf.message.Message.PROTOCOL_HEADERS={JMS_IBM_Character_Set=[IBM437], JMS_IBM_Encoding=[273 ], JMS_IBM_Format=[ ], JMS_IBM_MsgType=[8], JMS_IBM_PutApplType=[28], JMS_IBM_PutDate=[20140910], JMS_IBM_PutTime=[15475401], JMSDeliveryMode=[1], JMSExpiration=[0], JMSMessageID=[ID:414d 5120484b49424b31533120202020318cf553bd565320] , JMSPriority=[0], JMSRedelivered=[false], JMSTimestamp=[1410364074010], JMSXAppID=[Websphere MQ Client for Java], JMSXDeliveryCount=[1], JMSXUserID=[root ]}, JMSXUserID=root , org.apache cxf.interceptor.LoggingMessage.ID=2, JMS_IBM_MsgType=8, JMSReplyTo=null, JMSTimestamp=1410364074010, JMSDestination=null, JMSType=null, JMSXDeliveryCount=1, JMSRedelivered=false, javax.xml.ws.wsdl.interface={http :/www.xxx.xxx/xxxxx/xxxx/}xxxx, org.apache.cxf.request.uri=null, HTTP.REQUEST=null, ยอมรับ=/, 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, JMS_IBM_PutDate=20140910, org.apache.cxf.binding.soap.SoapVersion=org.apache.cxf.binding.soap.Soap11@ab8a96, JMS_IBM_PutTime=15475401, org.apache.c เอ็กซ์เอฟ .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 สำหรับ 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_PutDate=20140910, JMSPriority=0, JMSRedelivered=false, JMS_IBM_Encoding=273, operationNamespace=http://www.xxx.xxx/xxx/xxx=xxxx, CamelJmsMessageType=Object, JMS_IBM_PutTime=15475401, JMSMessageID=ID:414d5120484b49424b31533120202020318cf553bd565320, JMS_IBM_MsgType=8}, BodyType: com.xxx.xxxx.base.vo PayloadDTO, Body:com.xxx.xxxx.base.vo.PayloadDTO@e486e6 16:33:19,466 ข้อมูล [STDOUT] 16:33:19.466 เธรด [Camel (csCamelConfig) #8 - JmsConsumer[paymJmsReqQueue]] DEBUG o.a.camel.processor .SendProcessor - >>>> จุดสิ้นสุด[bean://responseProcessor?method=process] Exchange[ข้อความ: com.scb.channels.base.vo.PayloadDTO@e486e6] JmsConsumer[reqQueue]] DEBUG o.a.c.c.jms.EndpointMessageListener - จุดสิ้นสุด[ pwmq://queue:reqQueue?concurrentConsumers=2&exchangePattern=InOnly&jmsMessageType=Object&maxConcurrentConsumers=10&maxMessagesPerTask=2] ผู้บริโภคได้รับข้อความ JMS:
คลาส JMSMessage: jms_bytes
JMSType: null
JMSDeliveryMode: 2
JMSExpiration: 0
JMSPriority: 4
JMSMessageID: ID:414d5120484b49424b31533120202020318cf553051a5420
JMSTimestamp: 1410364124990
JMSCorrelationID: null
JMSDestination: null
JMSRep lyTo: null
JMSRedelivered: false
JMSXAppID: WebSphere ไคลเอ็นต์ MQ สำหรับ Java
JMSXDeliveryCount: 1
JMSXUserID: ibnkmq
JMS_IBM_Character_Set: IBM437
JMS_IBM_Encoding: 273
JMS_IBM_Format:
JMS_IBM_MsgType: 8
JMS_IBM_PutApplType: 28
JMS _IBM_PutDate: 20140910
JMS_IBM_PutTime: 15484499
aced000573720023636f6d2e7363622e6368616e6e656c732e626173652e766f2e5061796c6f6164
44544 f163e357ea7d7ff690200044c000c63757272656e7453746174657400124c6a6176612f6c61
6e672f537472696e673b4c000972657175657374564f74 00214c636f6d2f7363622f6368616e6e65
6c732f626173652f766f2f42617365564f3b4c000a726573706f6e7365564f71007e00024c000974
7 2616365506174687400104c6a6176612f7574696c2f4c6973743b7870707372002b636f6d2e7363
622e6368616e6e656c732e626173652e766f2e42 696c6c657250617952657175657374564f6aa292
32aa1e2e1f0200034c00106163636f756e74496e7175697279564f74002b4c636f6d2f7363622f6 3
68616e6e656c732f626173652f766f2f4163636f756e74496e7175697279564f3b4c001562696c6c
506179526567697374726174696f6e564f 7400304c636f6d2f7363622f6368616e6e656c732f6261
73652f766f2f42696c6c506179526567697374726174696f6e564f3b4c001262696c6c657 2506179
. ..

- person Calanais; 11.09.2014