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.

-bob

Gary Tully wrote:
> 
> have you set:
> 
> factory.setObjectMessageSerializationDefered(true);
> 
> 
> http://activemq.apache.org/how-should-i-use-the-vm-transport.html
> 
> On 16 February 2010 16:49, bob.deremer
> <bob.dere...@burningskysoftware.com>wrote:
> 
>>
>> Hi all ActiveMQ gurus,
>>
>> BACKGROUND:
>> 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.
>>
>> QUESTION:
>> 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:
>> http://old.nabble.com/HOW-TO%3A-confirm-copyMessageOnSend-is-working----tp27611334p27611334.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> http://blog.garytully.com
> 
> Open Source Integration
> http://fusesource.com
> 
> 

-- 
View this message in context: 
http://old.nabble.com/HOW-TO%3A-confirm-copyMessageOnSend-is-working----tp27611334p27612953.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to