activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hans Bausewein <ha...@comerwell.xs4all.nl>
Subject Re: Can we send a JAVA object to ActiveMQ JMS Queue
Date Mon, 10 Nov 2008 08:20:55 GMT


manish_goyal wrote:
> 
> Hi,
> 
> I am using Java application to send a JAVA Object to ActiveMQ JMS queue. 
> Is this possible to send ?
> 
> I m using following method to send JAVA Object but it's not accepting JAVA
> object.
> producer.send(session.createObjectMessage(java_object));
> 

Is your object Serializable?

What exception do you get?

See Javadoc of "javax.jms.ObjectMessage":
http://java.sun.com/j2ee/1.4/docs/api/

An ObjectMessage object is used to send a message that contains a
serializable object in the Java programming language ("Java object"). It
inherits from the Message interface and adds a body containing a single
reference to an object. Only Serializable Java objects can be used.

If a collection of Java objects must be sent, one of the Collection classes
provided since JDK 1.2 can be used.

When a client receives an ObjectMessage, it is in read-only mode. If a
client attempts to write to the message at this point, a
MessageNotWriteableException is thrown. If clearBody is called, the message
can now be both read from and written to.

============
Of course, you must also consume the message as a Java Object.

Hans

-- 
View this message in context: http://www.nabble.com/Can-we-send-a-JAVA-object-to-ActiveMQ-JMS-Queue-tp20415514p20415969.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message