activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "bob.deremer" <>
Subject Re: HOW TO: confirm copyMessageOnSend is working???
Date Tue, 16 Feb 2010 18:32:05 GMT

Sorry for not posting this update sooner...

I managed to figure out what is going on by downloading the 5.3.0 source
code and digging into the ActiveMQConnection and Session classes.  I can see
that the object being set as the payload of an ObjectMessage must have the
Serializable "tag" interface.  In addition, all types inside the object must
also implement Serializable or be a primitive java type.   This makes sense
that the ObjectMessage [and any message for that matter] be serializable
because it needs to be able to cross boundaries seemlessly when required. 

The key is the setObjectMessageSerializationDefered setter on the
Connection/ConnectionFactory objects - as Gary points out below.  The
copyMessageOnSend just keeps from making a copy prior to sending, but
doesn't control whether the ObjectMessage's payload gets serialized via the
ObjectMessage.storeContent method.

Sorry for posting before checking the source.  I hope this may have helped
out some others with the similar question.


Gary Tully wrote:
> have you set:
> factory.setObjectMessageSerializationDefered(true);
> On 16 February 2010 16:49, bob.deremer
> <>wrote:
>> Hi all ActiveMQ gurus,
>> I'm using AMQ 5.3 with the local vm:// transport and wish to make use of
>> the
>> copyMessageOnSend = FALSE convention to send my messages by reference
>> [instead of by value].  Given the dynamic nature of our
>> ObjectMessage-based
>> messages and varying size of the message content, we want to avoid any
>> unncessary serialization/deserialization whereever possible.  I am
>> currently
>> setting this property on the producer's ConnectionFactory, so [according
>> to
>> the AMQ docs] this should be properly configured.
>> Why does the createObjectMessage(...) throw an exception when I try and
>> create an ObjectMessage from my custom object that has sub-objects inside
>> of
>> it that do NOT implement Serializable?  I can understand the top-level
>> object being passed to createObjectMessage requiring Serializable because
>> that is how the method is defined.  BUT, if copyMessageOnSend == FALSE is
>> being used, why is the whole object chain being checked for Serializable
>> [if
>> it's not going to be serialized]?  My BIG concern is that some level of
>> serialization is being done when it shouldn't be.
>> Please help me understand what's going on under the hood.  I don't want
>> to
>> force all objects going into ActiveMQ to implement Serializable if they
>> really aren't going to be serialized.
>> Thanks in advance for clarification on this,
>> Bob
>> --
>> View this message in context:
>> Sent from the ActiveMQ - User mailing list archive at
> -- 
> Open Source Integration

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message