activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian McCallister <bri...@apache.org>
Subject Re: STOMP and JMSType
Date Mon, 12 Jun 2006 21:03:52 GMT
JMSType is a reserved header in JMS, for use at the application  
level. I think what you are proposing is more accurately an ActiveMQ  
specific transform header. I think this type of transform should  
either be a real, arbitrary, pluggable, transform mechanism, or  
should not be done.

I would much prefer to *always* use a bytes message, but this is  
backwards incompatible so cannot be done in 4.X.

I would propose that instead of overloading JMSType, if we think we  
need to have a transform/mapping mechanism we base it on an active-mq  
specific header, and make it something like:

STOMPMessageTransformer {
   public ActiveMQMessage transform 
(SomeRepresentationOfTheSendFrameIncludingHeaders frame) {
     ...
   }
}

I am not convinced we need this, but I much prefer it to a hardcoded  
transform, as this would allow for much more useful transforms (ie,  
aplication-aware).

I think that, properly, this should be done by a service on the  
messaging bus though, NOT in a protocol handler.

-Brian

On Jun 12, 2006, at 12:59 PM, Mittler, Nathan wrote:

> 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
>
>
>
>
>


Mime
View raw message