I'm working on fixing the way the STOMP transport determines Text and
Bytes messages for issue AMQ-739. Previously we keyed off of the
content-length header - if it was there, it's a bytes message, and
otherwise it's a text message.
Since all STOMP messages can have content-length, we need to use JMSType
to distinguish in these cases. To do this, we need to define standard
JMSType values for Text and Bytes messages. I have a build that uses
"text" and "bytes" as the standard values for the "type" header. On the
broker side, the logic in Send.java looks like this ...
****** BEGIN CODE ******
// Assume the message is a bytes message.
Boolean isBytesMessage = true;
// If the message does not contain a content length,
// we have to assume it's a text message - first zero
// we encounter denotes the end of the frame.
If( !headers.containsKey(Stomp.Headers.CONTENT_LENGTH) ){
isBytesMessage = false;
}
// There is a content length specified,
// now use JMSType to determine the message type (default to bytes if
none specified)
else if( headers.containsKey( Stomp.Headers.Send.TYPE ) ){
isBytesMessage =
(headers.getProperty(Stomp.Headers.Send.TYPE) ==
Stomp.Headers.TypeValues.BYTES);
}
if( isBytesMessage ){
// create a bytes message.
}else{
// create a text message.
}
****** END CODE *******
Any objections?
Regards,
Nate