|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Propagate a Java object from JavaCompute node |
« View previous topic :: View next topic » |
Author |
Message
|
nickkirk |
Posted: Mon Mar 28, 2011 4:06 am Post subject: Propagate a Java object from JavaCompute node |
|
|
Apprentice
Joined: 26 Sep 2008 Posts: 48
|
What is the syntax to propagate a Java object ?
For example, this is how I propagate a byte array output stream;
outMessage.getRootElement().createElementAsLastChild(MbBLOB.PARSER_NAME).createElementAsFirstChild(MbElement.TYPE_NAME_VALUE, MbBLOB.ROOT_ELEMENT_NAME, ((ByteArrayOutputStream)outputStream).toByteArray() );
If I had a class named MyClass, how would I do this ? |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Mar 28, 2011 4:30 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You don't understand Broker at all.
The only things that get propagated are Logical Message Trees, not Objects of any kind.
You can not and SHOULD NOT treat Broker like a JEE App Server or a JVM in general.
You need to focus on learning Broker as it is, and NOT spend time trying to make it into something it is not.
Broker provides powerful native functions for doing a lot of things, that do not require any Java coding at all. They do not, in general, work with Java Objects.
You should learn Broker before you try to go much further down the path of propagating Java Objects.
Anything else will leave you in a world of hurt and create unmaintable and overly complex solutions. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Mon Mar 28, 2011 4:31 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
|
Back to top |
|
 |
mqjeff |
Posted: Mon Mar 28, 2011 4:38 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
lancelotlinc wrote: |
You serialize the class into a byte array. |
Well, yes, that certainly meets some definition of how to propagate a Java Object.
Except, of course, it's not a Java object anymore. It's a bitstream.
And using Java Object Messages in general is extremely non-portable and a bad idea. There's no guarantee that anyone receiving it will be at the same level of Java and have the exact same version of the relevant classes.
So, again, DO NOT PROPAGATE JAVA OBJECTS.
Despite any personal success that you may have had with such, lancelotlinc, it is NOT the right thing to do and is NOT a solution for most people. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Mon Mar 28, 2011 4:49 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
@mqjeff
I was not addressing the viability of doing what the OP wanted. He asked "How?" not "Is it a good thing to do?" I answered by providing the solution to "How".
What he or she does with it, is up to them. I get your point in that the application of the solution may not fit the need of most people. I agree with you. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
nickkirk |
Posted: Mon Mar 28, 2011 6:22 am Post subject: |
|
|
Apprentice
Joined: 26 Sep 2008 Posts: 48
|
Thanks lancelotlinc, got it working  |
|
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
|
|
|
|