activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "bob.deremer" <bob.dere...@burningskysoftware.com>
Subject URGENT QUESTION: AMQ 5.3.0 bug or configuration error??? - ObjectMessage is [still] being serialized when using setObjectMessageSerializationDefered and setCopyMessageOnSend
Date Fri, 19 Feb 2010 15:56:26 GMT

I'm sorry for the extremely URGENT nature of this question, but I believe
I've either come across a bug in AMQ 5.3.0 or I need additional
configuration settings.  I have multiple POJO(s) that are using an embedded
ActiveMQ broker via "vm" access.  They are sending custom objects around as
the payload of the event messages and we [cannot] have them being
serialized.

I have listed the problem, my debugging steps so far, and my code for
creating connections - in case I'm missing something.  I'm hoping that this
is a matter of me needing to do some extra configuration, so please advise! 

Thanks in advance,
Bob

===================================================

PROBLEM:
ObjectMessage(s) are [still] being serialized even after setting
setObjectMessageSerializationDefered = true and setCopyMessageOnSend = false
on my ActiveMQConnectionFactory object.

To verify that the instructions on the ActiveMQ site regarding disabling
ObjectMessage serialization are correct, I decided to implement
Externalizable on one of my custom classes that are in the object being put
in the ObjectMessage.  

I was very surprised to see that when the ObjectMessage is sent via
MessageProducer.send(om) - it is being serialized!  And, when the
ObjectMessage is dispatched into the MessageConsumer's onMessage, it is
being de-serialized.

So, I set a breakpoint in my readExternal and writeExternal methods.  The
code that is serializing the ObjectMessage is in: activemq-5.3.0 source:
ActiveMQConnection.java [lines 1662 - 1667].  I've listed them below.  It
even talks about copying the message in case an embedded broker is
dispatching via vm:// - which is confusing to me.

                        if (dispatcher != null) {
                            // Copy in case a embedded broker is dispatching
via
                            // vm://
                            // md.getMessage() == null to signal end of
queue
                            // browse.
                            Message msg = md.getMessage();
                            if (msg != null) {
                                msg = msg.copy();
                                msg.setReadOnlyBody(true);
                                msg.setReadOnlyProperties(true);
                               
msg.setRedeliveryCounter(md.getRedeliveryCounter());
                                msg.setConnection(ActiveMQConnection.this);
                                md.setMessage(msg);
                            }
                            dispatcher.dispatch(md);
                        }

SCENARIO:
I'm creating an embedded broker and creating connections from an
ActiveMQConnectionFactory instance that is using the URL =
"vm://MyEmbeddedBroker".  The code looks like the following.  I am then
creating a connection from this, which is then used for creating my
MessageProducer(s) and MessageConsumer(s).

        private String user = ActiveMQConnection.DEFAULT_USER;
        private String password = ActiveMQConnection.DEFAULT_PASSWORD;
        private String url = "vm://MyEmbeddedBroker";	
	private ActiveMQConnectionFactory connectionFactory;

        this.connectionFactory = new ActiveMQConnectionFactory(user,
password, url);
        this.connectionFactory.setOptimizedMessageDispatch(true);

        // set these so the object is NOT serialized when sending messages
        this.connectionFactory.setObjectMessageSerializationDefered(true);
        this.connectionFactory.setCopyMessageOnSend(false);


-- 
View this message in context: http://old.nabble.com/URGENT-QUESTION%3A-AMQ-5.3.0-bug-or-configuration-error------ObjectMessage-is--still--being-serialized-when-using-setObjectMessageSerializationDefered-and-setCopyMessageOnSend-tp27654579p27654579.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message