ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Propagate a Java object from JavaCompute node

Post new topic  Reply to topic
 Propagate a Java object from JavaCompute node « View previous topic :: View next topic » 
Author Message
nickkirk
PostPosted: Mon Mar 28, 2011 4:06 am    Post subject: Propagate a Java object from JavaCompute node Reply with quote

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
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Mon Mar 28, 2011 4:30 am    Post subject: Reply with quote

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
View user's profile Send private message
lancelotlinc
PostPosted: Mon Mar 28, 2011 4:31 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

You serialize the class into a byte array. Then pass the byte array as you gave in your example.

If you need information on serialization in Java, here is a good link to get started.

http://java.sun.com/developer/technicalArticles/Programming/serialization/

If you have problems after you have tried it, please post your questions.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Mon Mar 28, 2011 4:38 am    Post subject: Reply with quote

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
View user's profile Send private message
lancelotlinc
PostPosted: Mon Mar 28, 2011 4:49 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
nickkirk
PostPosted: Mon Mar 28, 2011 6:22 am    Post subject: Reply with quote

Apprentice

Joined: 26 Sep 2008
Posts: 48

lancelotlinc wrote:
You serialize the class into a byte array. Then pass the byte array as you gave in your example.

If you need information on serialization in Java, here is a good link to get started.

http://java.sun.com/developer/technicalArticles/Programming/serialization/

If you have problems after you have tried it, please post your questions.



Thanks lancelotlinc, got it working
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Propagate a Java object from JavaCompute node
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.