What is the use of BytesMessage?BytesMessage contains an array of primitive bytes in it's payload. When the datatypes of two applications are not compatible with other message types, they can send them using ByteMessage. JMS can be simply used as a transport medium with the payload being opaque to the JMS client.
However, it is important that the payload be read in the same order and type when it was created. Since there is no boundary line between the different data types stored, you can even read a long as short. This would result in erroneous data.
|