What is the use of ObjectMessage?



What is the use of ObjectMessage?..

Answer / 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

More JMS Interview Questions

Can we send message from one server to another server using jms?

0 Answers  


What is jms correlation id?

0 Answers  


Can JMS utilities automatically re-establish a connection if one side of the communication link (i.e. an application that's sending/receiving messages) goes down and is restarted? Are there APIs to help detect that the other side broke a connection (went down)?

1 Answers  


What are the three parts of the message?

0 Answers  


What Is the JMS API?

1 Answers  






Which messaging is generally used in cases where a message is published by a producer and consumed by multiple subscribers?

0 Answers  


Is activemq a jms provider?

0 Answers  


How does a typical client perform the communication?

1 Answers  


What is the use of jmstemplate in spring?

0 Answers  


Is kafka a jms?

0 Answers  


What is JMS Client?

1 Answers  


Why do we need jms?

0 Answers  


Categories