-
1. Re: spawned process (class) on the queue
barnaby_morris Feb 12, 2002 5:33 PM (in response to nikolaj)Just have your JMS client cast the object retrieved from the MessageObject to a known interface type that you make up and that any object type you send must implement. Maybe the interface has a run() method and that is what your client always runs.
-
2. Re: spawned process (class) on the queue
nikolaj Feb 14, 2002 4:53 AM (in response to nikolaj)Hmm, thanks for your input, but :-) ... I can only send a TextMessage... I get an ClassNotFound exception if I try to send a object. Do you have an example somewhere... just to send an object.
/nikolaj
PS "getInstance of" works but when I try to cast the object so I can read the object, the error comes? -
3. Re: spawned process (class) on the queue
barnaby_morris Feb 14, 2002 1:38 PM (in response to nikolaj)You need to make sure that the class is in the classpath of both the sender and receiver.
// on the sender
// the object that you are sending must implement Serializable
// assuming connection, session, and sender already set up
ObjectMessage message = queueSession.createObjectMessage(mySerializable);
queueSender.send(message);
// not showing exception handling here
===========
// on the receiver
public void onMessage(Message message) {
Serializable mySerializable = null;
try {
// this won't work unless this JVM has access to the class for the object
mySerializable = ((ObjectMessage)message).getObject();
} catch (JMSException jmse) {
// something blew up - do something about it
}
// now you have your object - do something with it
} -
4. Re: spawned process (class) on the queue
nikolaj Feb 17, 2002 8:15 AM (in response to nikolaj)Hi Morris,
I'll try it, thanks.