JMS 1.1 - Section 3.11.3 - StreamMessage and MapMessage conversions
carterpage opened this issue · comments
The following types can be set with the inputs in parentheses (and one's own type):
- boolean (String)
- byte (String)
- short (byte, String)
- char (String)
- int (byte, short, String)
- long (byte, short, int, String)
- float (String)
- double (float, String)
- String (all the above, but not byte[])
- byte[](only itself)
Cases that don't match the above conversions must throw MessageFormatException.
String to numeric conversions should basically call the appropriate valueOf() message. In cases of setting a numeric with an invalid string representation a NumberFormatException should be thrown.
String to boolean conversion must be implemented via Boolean.valueOf(String)
If a read method of StreamMessage or ByteMessage throws a MessageFormatException or NumberFormatException, the current position of the read pointer must not be incremented. A subsequent read must be capable of recovering from the exception by rereading the data as a different type.
When passed between clients, a message must always retain its full form. For instance, a message sent as MapMessage must not arrive at a JMS client as a BytesMessage.
"If a provider receives a message created by a native (non-JMS?) client, the provider should do its best to transform it into the best JMS message type. For instance, if it is a native stream message, it should be transformed into a StreamMessage. If this is not possible, the provider is always able to transform it into a BytesMessage."