PDA

View Full Version : Serializables and ObjectMessage support


mperham
Aug 25th, 2004, 01:30 PM
Why doesn't SimpleMessageConverter support Serializable objects via the ObjectMessage type? Is this just something that hasn't been implemented yet or is there a reason to avoid this design?

mperham
Aug 25th, 2004, 01:35 PM
Index: SimpleMessageConverter.java
================================================== =================
RCS file: /cvsroot/springframework/spring/src/org/springframework/jms/support/converter/SimpleMessag
eConverter.java,v
retrieving revision 1.3
diff -u -r1.3 SimpleMessageConverter.java
--- SimpleMessageConverter.java 21 Aug 2004 15:39:46 -0000 1.3
+++ SimpleMessageConverter.java 25 Aug 2004 17:41:08 -0000
@@ -74,6 +74,9 @@
}
return message;
}
+ else if (object instanceof Serializable) {
+ return session.createObjectMessage((Serializable) object);
+ }
else {
throw new MessageConversionException("Cannot convert object [" + object + "] to JMS message");
}
@@ -103,6 +106,10 @@
}
return map;
}
+ else if (message instanceof ObjectMessage) {
+ ObjectMessage msg = (ObjectMessage) message;
+ return msg.getObject();
+ }
else {
throw new MessageConversionException("Cannot convert JMS message [" + message + "] to object");
}

Juergen Hoeller
Aug 25th, 2004, 02:34 PM
Actually, the initial version of SimpleMessageConverter had support for ObjectMessage. I removed it after Mark argued that serialization was not something to recommend for messaging. I'll get back to him again - from my point of view, I wouldn't mind readding that support.

Juergen

lblaauw
Nov 22nd, 2004, 01:41 PM
Actually, the initial version of SimpleMessageConverter had support for ObjectMessage. I removed it after Mark argued that serialization was not something to recommend for messaging. I'll get back to him again - from my point of view, I wouldn't mind readding that support.

Juergen

Well,

After completing some projectts in wich we decided to just put object messages on a message queue, these days i favour XML based messages.
It gives you better readability on the actual messages in the queue for administration purposes and you avoid the type guid in your classes or if you skip that problems when upgrading the classes of objects allready on the queue...

So right now i am trying to implement a castor based messageconverter, since we allready use castor in my current project for serialisation en d-serialisation.

Greetz
Leo de Blaauw

lblaauw
Nov 22nd, 2004, 03:47 PM
Actually, the initial version of SimpleMessageConverter had support for ObjectMessage. I removed it after Mark argued that serialization was not something to recommend for messaging. I'll get back to him again - from my point of view, I wouldn't mind readding that support.

Juergen

Well,

After completing some projectts in wich we decided to just put object messages on a message queue, these days i favour XML based messages.
It gives you better readability on the actual messages in the queue for administration purposes and you avoid the type guid in your classes or if you skip that problems when upgrading the classes of objects allready on the queue...

So right now i am trying to implement a castor based messageconverter, since we allready use castor in my current project for serialisation en d-serialisation.

Greetz
Leo de Blaauw


Ok, done castor is now used to serialize our objects onto JMS queues using the JMSTemplate with a Castor converter, tomorrow i will do the read from the message queue convert stuff

Let me know if i need to post how

Greetz
Leo de Blaauw