What is the difference between BytesMessage and StreamMessage?



What is the difference between BytesMessage and StreamMessage?..

Answer / munnu

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.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More JMS Interview Questions

How do I configure jms security?

0 Answers  


Does JMS specification define transactions?

1 Answers  


What is jms message queue?

0 Answers  


What is Map message?

1 Answers  


Why is my jms work not part of a user transaction (i.e., Called within a transaction but not rolled back appropriately)? How do I track down transaction problems?

0 Answers  






What is a distributed queue?

0 Answers  


Mention different types of messages available in JMS API?

0 Answers  


What is the diffrence between Java Mail and JMS Queue?

1 Answers  


What is jms connection?

0 Answers  


What is the principle difference between the working mechanism of jms and rpc?

0 Answers  


What is the functionality of a jms message selector?

0 Answers  


How many types of messaging model do JMS provide for and what are they?

0 Answers  


Categories