What is the difference between BytesMessage and StreamMessage?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Name the components of jms.

521


What does jms stand for?

459


What is the main parts of jms applications?

485


Which messaging modes are included in the java messaging service jms )?

456


What is a JMS client?

545






For JMS-enabled application, what are the core JMS-related objects required?

525


Mention different types of messages available in JMS API?

468


How does a sender application transport/send a message through jms?

478


In which situations we are using jms?

497


Can jms be used to send an email?

459


What is the use of EventMessage.java?

1108


Is ibm mq jms compliant?

428


What is jms broker in sas?

603


What are the steps to send and receive JMS message ?

992


Mention the difference between durable and non-durable subscription?

464