What is the use of ObjectMessage?

Answer Posted / munnu

ObjectMessage contains a Serializable java object as it's payload. Thus it allows exchange of Java objects between applications. This in itself mandates that both the applications be Java applications. The consumer of the message must typecast the object received to it's appropriate type. Thus the consumer should before hand know the actual type of the object sent by the sender. Wrong type casting would result in ClassCastException. Moreover the class definition of the object set in the payload should be available on both the machine, the sender as well as the consumer. If the class definition is not available in the consumer machine, an attempt to type cast would result in ClassNotFoundException. Some of the MOMs might support dynamic loading of the desired class over the network, but the JMS specification does not mandate this behavior and would be a value added service if provided by your vendor. And relying on any such vendor specific functionality would hamper the portability of your application. Most of the time the class need to be put in the classpath of both, the sender and the consumer, manually by the developer.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How kafka is different from jms?

466


How do the wls jms 6.1 server/destination message maximum and threshold values work?

461


What is mean by jms?

475


What is jms queue?

472


What is a messaging service?

492






Can we use jms for sending automated e-mails?

523


Mention the difference between durable and non-durable subscription?

464


What is mdb in jms?

483


What is queue connection factory?

449


Are there c/c++ interfaces to wls jms?

487


How do I use a third-party jdbc driver with jms?

483


What is jms mean?

441


Explain Synchronous Message Consumption in JMS?

1054


What is asynchronous messaging in jms?

467


What is jms connection factory in weblogic?

449