Set - 3

Question 11 :

What is the difference between BytesMessage and StreamMessage?

Answer :

BytesMessage stores the primitive data types by converting them to their byte representation. Thus the message is one contiguous stream of bytes. While the StreamMessage maintains a boundary between the different data types stored because it also stores the type information along with the value of the primitive being stored. BytesMessage allows data to be read using any type. Thus even if your payload contains a long value, you can invoke a method to read a short and it will return you something. It will not give you a semantically correct data but the call will succeed in reading the first two bytes of data. This is strictly prohibited in the StreamMessage. It maintains the type information of the data being stored and enforces strict conversion rules on the data being read.


Question 12 :

What is object message ?

Answer :

Object message contains a group of serializeable java object. So it allows exchange of Java objects between applications. sot both the applications must be Java applications.


Question 13 :

What is text message?

Answer :

Text messages contains String messages (since being widely used, a separate messaging Type has been supported) . It is useful for exchanging textual data and complex character data like XML.


Question 14 :

What is Map message?

Answer :

map message contains name value Pairs. The values can be of type primitives and its wrappers. The name is a string.


Question 15 :

What is the difference between queue and topic ?

Answer :

A topic is typically used for one to many messaging , while queue is used for one-to-one messaging. Topic .e. it supports publish subscribe model of messaging where queue supports Point to Point Messaging.