|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
JMS ObjectMessage and a Java Serialized Object |
« View previous topic :: View next topic » |
Author |
Message
|
pritch75 |
Posted: Tue Aug 12, 2008 8:34 am Post subject: JMS ObjectMessage and a Java Serialized Object |
|
|
Newbie
Joined: 02 Jul 2008 Posts: 3
|
I'm attempting to send a Java Serialized Object to a JMS enabled service with the JMS Output node. I have a Java class that implements the writeObject() method to do the serialization in Java. I'm using a Java Compute node to take the incoming XML message, set the setters on the Java object. Then, I'm using a ByteOutputStream and an ObjectOutputStream to get a byte array of the serialized object and putting that under a BLOB parser in the tree. Like this:
Code: |
ByteArrayOutputStream byteOutStream = new ByteArrayOutputStream();
ObjectOutputStream objOutStream = new ObjectOutputStream(byteOutStream);
objOutStream.writeObject(logRecord);
objOutStream.close();
MbElement outRoot = outMessage.getRootElement();
outRoot.createElementAsLastChildFromBitstream(byteOutStream.toByteArray(), MbBLOB.PARSER_NAME, null, null,null, 0, 0, 0); |
Right now, I have the out terminal from the Java Compute going directly to a JMS Output node and I have a message type of ObjectMessage set on the JMSOutput node. I'm getting Error number 4664/"unexpected block data" from the JMSOutput node. I do not get the same error when I serialize a String and not use my custom Java serialization.
Questions:
-Should I put a MQJMSTransform node in between?
-I've read another thread that is taking JMS ObjectMessages as input and it looks like they used a CWF to handle it (I'm trying to do this for output). Should I use a CWF here instead of the java compute and the custom serialization?
-What does "unexpected block data" mean? |
|
Back to top |
|
 |
vaibhav_vy |
Posted: Tue Aug 12, 2008 9:39 pm Post subject: |
|
|
Apprentice
Joined: 04 Aug 2008 Posts: 28
|
You have to put MQJMSTransform node in between when you use any input node other than JMSInput & your output node is JMSOutput. This node transform MQMD & MQRFH2 headers into JMS transport headers.
You might be getting unexpected block data error because of not using MQJMSTransform.
You dont need to use CWF to serialize the Java object. The code looks fine for serialization. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|