You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by brodyc <cw...@us.ibm.com> on 2006/10/27 22:10:01 UTC

Use of ObjectMessageSerializationDefered

Is there a way to send a message that contains an object which does not
implement Serializable when using integrated broker (
brokerURL=vm://localhost).

I read this on ActiveMQ website:

"Disabling Object serialization with ObjectMessage for ActiveMQ 4.x
=========================================
The JMS specification dictates that the body of an ObjectMessage must be
serialized when you call send() to avoid the object changing under your feet
affecting what view the consumer sees of the object.

You can disable the automatic serialization of ObjectMessage payloads so
that the objects are passed by value in 4.x by setting the
objectMessageSerializationDefered flag to true on the
ActiveMQConnectionFactory (or ActiveMQConnection)."

I thought that I could wrap my non-serializable object in a Serializable
envelope object and pass it on. Perhaps I am just naive to expect it to work
but the documentation led me to believe that this may be possible. When I
try this approach I get java.io.NotSerializableException

I use ActiveMQ 4.0.1 and Spring. My spring xml defines the factory as
follows:

<bean id="jmsFactory" class="org.apache.activemq.ActiveMQConnectionFactory"
> 
        <property name="brokerURL"
value="vm://localhost?broker.objectMessageSerializationDefered=true"/> 
    </bean>

Thanks, jc

-- 
View this message in context: http://www.nabble.com/Use-of-ObjectMessageSerializationDefered-tf2522832.html#a7037470
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Use of ObjectMessageSerializationDefered

Posted by Adrian Co <ac...@exist.com>.
I'm not sure if it should work or not. But maybe you can try setting 
copyMessageOnSend to false.

brodyc wrote:
> Is there a way to send a message that contains an object which does not
> implement Serializable when using integrated broker (
> brokerURL=vm://localhost).
>
> I read this on ActiveMQ website:
>
> "Disabling Object serialization with ObjectMessage for ActiveMQ 4.x
> =========================================
> The JMS specification dictates that the body of an ObjectMessage must be
> serialized when you call send() to avoid the object changing under your feet
> affecting what view the consumer sees of the object.
>
> You can disable the automatic serialization of ObjectMessage payloads so
> that the objects are passed by value in 4.x by setting the
> objectMessageSerializationDefered flag to true on the
> ActiveMQConnectionFactory (or ActiveMQConnection)."
>
> I thought that I could wrap my non-serializable object in a Serializable
> envelope object and pass it on. Perhaps I am just naive to expect it to work
> but the documentation led me to believe that this may be possible. When I
> try this approach I get java.io.NotSerializableException
>
> I use ActiveMQ 4.0.1 and Spring. My spring xml defines the factory as
> follows:
>
> <bean id="jmsFactory" class="org.apache.activemq.ActiveMQConnectionFactory"
>   
>         <property name="brokerURL"
> value="vm://localhost?broker.objectMessageSerializationDefered=true"/> 
>     </bean>
>
> Thanks, jc
>
>