activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Bish <tabish...@gmail.com>
Subject RE: ActiveMQcpp cms::Session::createTextMessage() function usage question with ISO-8859-1 strings
Date Thu, 30 Jul 2009 22:46:52 GMT
On Thu, 2009-07-30 at 18:21 -0400, Olivier Langlois wrote:
> Tim,
> 
> Would adding a cms::Session::createUTF8TextMessage( const std::string & ) function
to the CMS API be something acceptable for the project maintainers?
> 
> > > Is there a way to tell the API to skip the UTF-8 conversion?
> > >
> > > Greetings,
> > > Olivier
> > >
> > 

My suggestion would be to create a new Jira Issue to request the sort of
functionality that you need.  However I don't think that it would be
implemented as a separate method in the near future as the CMS API is
sealed until the next major version release which isn't currently
planned.  Another thing to consider is that there are variations of
UTF-8 encoding so providing the method as proposed is tricky since its
hard to check that the user has supplied a string in "Modified UTF-8"
which is the format used by Java and other flavors of UTF-8 would not
marshal correctly as they are incompatible with UTF-8 proper.

See: http://en.wikipedia.org/wiki/UTF-8#UTF-8_derivations

The quickest solution to the problem you are facing would be to send the
message as a BytesMessage on the CPP client side, with the payload being
your UTF-8 encoded string and then employ the Message Transformation
mechanism of ActiveMQ to turn those message back into TextMessage
instances on the Java client side, you could use a message property to
flag the messages as needing transformation or you could use a dedicated
Topic or Queue to send them to and transform all BytesMessage's to
TextMessage's.  Be aware that if your data isn't encoded as Modified
UTF-8 you would need to account for that in the Transformation.

see: http://activemq.apache.org/message-transformation.html

Regards
Tim.




-- 
Tim Bish
http://fusesource.com
http://timbish.blogspot.com/




Mime
View raw message