permaculture playing cards
The moose likes EJB and other Java EE Technologies and the fly likes How to send json via jms Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How to send json via jms" Watch "How to send json via jms" New topic

How to send json via jms

ray frid
Ranch Hand

Joined: Dec 23, 2010
Posts: 79

I am using JMS in my architecture in many ways.

Latency and performance are very big factor in our architecture.

I've read that using jms with ObjectMessage in order to pass whole java object within the message takes lots of performances.

Alternative solution is converting to json,protobuff and having the message being sent as a bytemessage/text message.

Could you please make this clear for me:

in case I choose json. after converting from String to json should I send the message
as test or as ByteArray? (any difference?)

Is the the total time of converting String to json from the sender side and
vice versa on the consumer side will be less/more then just sending ObjectMessage?

thanks, ray.
Amarnath Ramasamy

Joined: Feb 05, 2010
Posts: 7
You can JSON string as text message itself. Convert your object to JSON string using Json parsers and send it via text message. This is definitely better than ObjectMessage. Thanks

Amarnath RC
I agree. Here's the link:
subject: How to send json via jms
It's not a secret anymore!