ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » I'm sending an ObjectMessage but receiving a JMSBytesMessage

Post new topic  Reply to topic
 I'm sending an ObjectMessage but receiving a JMSBytesMessage « View previous topic :: View next topic » 
Author Message
buckrodgers
PostPosted: Wed Feb 03, 2010 1:05 pm    Post subject: I'm sending an ObjectMessage but receiving a JMSBytesMessage Reply with quote

Newbie

Joined: 03 Feb 2010
Posts: 2

I'm sending an ObjectMessage to a local queue, however my MDB is reading a JMSBytesMessage. Isn't there a way to get this message as an ObjectMessage ?

I'm using WAS 7 and MQ 6
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Feb 03, 2010 1:16 pm    Post subject: Re: I'm sending an ObjectMessage but receiving a JMSBytesMes Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

buckrodgers wrote:
Isn't there a way to get this message as an ObjectMessage ?


a) My Java sucks so I'm not entirely certain (!)
b) No I don't think there is
c) My understanding is that it's considered best practice to serialise / deserialize Java objects for transmission anyway

Someone who doesn't suffer from a) above will be along shortly, and they may correct either b) or c)
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Feb 03, 2010 1:20 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You can cast it to an ObjectMessage, of course.

But how do you know you have the necessary versions of the classes that were used to build the ObjectMessage in the first place?

What happens if you need to send the same information to a consumer that is not written in Java?

ObjectMessages are extremely unportable.
Back to top
View user's profile Send private message
buckrodgers
PostPosted: Wed Feb 03, 2010 4:16 pm    Post subject: Reply with quote

Newbie

Joined: 03 Feb 2010
Posts: 2

Thanks for the reply.

The app that is the producer is also the consumer so everything should be the same when getting the message back and processing it.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Feb 03, 2010 4:35 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

buckrodgers wrote:
The app that is the producer is also the consumer so everything should be the same when getting the message back and processing it.


We all hope this happy fact remains true for the life of this design.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
manicminer
PostPosted: Thu Feb 04, 2010 1:05 am    Post subject: Re: I'm sending an ObjectMessage but receiving a JMSBytesMes Reply with quote

Disciple

Joined: 11 Jul 2007
Posts: 177

Vitor wrote:
buckrodgers wrote:
Isn't there a way to get this message as an ObjectMessage ?


a) My Java sucks so I'm not entirely certain (!)
b) No I don't think there is
c) My understanding is that it's considered best practice to serialise / deserialize Java objects for transmission anyway

Someone who doesn't suffer from a) above will be along shortly, and they may correct either b) or c)


I agree with c)

Don't use object messages, transform your data into some intermediate format (xml is popular) and use that. This provides much better interoperability as apps other than java can read the data (e.g. message broker could do content based routing on your xml if required) and avoids all the contact admin Java serialisation pitfalls that will almost certainly bite you at some point in the applications lifetime!

Side note: In theory serialised objects should be fine, but one day someone will add a field to your object without considering the serialisation impact. Or will create a new object and forget to specify the serial UID. Or will add a field that is not serialisable etc.
_________________
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Feb 04, 2010 5:31 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

buckrodgers wrote:
Thanks for the reply.

The app that is the producer is also the consumer so everything should be the same when getting the message back and processing it.


Yes, that's certainly true today.

Tomorrow, when someone else needs a copy of the message, or when for performance reasons the producer component gets moved to a separate machine from the consumer component, and then gets upgraded separately...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » I'm sending an ObjectMessage but receiving a JMSBytesMessage
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.