activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Bish <tabish...@gmail.com>
Subject Re: Creating message from byte[]
Date Wed, 25 Nov 2009 19:20:41 GMT
On Wed, 2009-11-25 at 09:12 -0800, jhakim wrote:
> Thanks Tim. We are using ICSharpCode
> (http://www.icsharpcode.net/OpenSource/SharpZipLib/) for end-to-end
> compression between C#/Java clients using TIBCO EMS. 
> 
> In any case, does the native ActiveMQ compression provide end-to-end
> compression between C#/Java clients? If not, how do we get C#/Java clients
> to exchange compressed messages?

The Java client can send and receive messages with compressed message
bodies.  The body is compressed using the Java Deflate classes which
work with ZLib compression.  In order to send and receive compressed
messages from Java to .NET clients the .NET client needs to be able to
handle Zlib compression as well.  We didn't want to tie the user to a
particular compression library with NMS.ActiveMQ so we provide an
interface class that the user can implement to give us access to a
Stream class that can compress or decompress the message body.

If you grab the latest code from SVN you will find an interface called
ICompressionPolicy in the NMS.ActiveMQ project.  The default
implementation uses the .NET gzip Stream classes so those aren't going
to work if you want to send to a Java client, you'd need to provide a
new policy class.  If you take a look at the MessageCompressionTest.cs
file in the NMS.ActiveMQ test/csharp/Commands folder you will see how
this is done.  

Regards
Tim.


>  
> 
> Timothy Bish wrote:
> > 
> > On Tue, 2009-11-24 at 07:55 -0800, jhakim wrote:
> >> I would like to create a large (40+ MB) MapMessage, get its byte[],
> >> compress
> >> the bytes, and send it across the wire as a BytesMessage. On the
> >> receiving
> >> side, I would like to read the byte[], uncompress, and create the
> >> original
> >> MapMessage from the byte[].
> >> 
> >> We have been using this strategy with great success using TIBCO EMS. We
> >> have
> >> a mix of clients - Java and C#.
> >> 
> >> As we look at ActiveMQ as an alternative to TIBCO EMS, I am wondering if
> >> there is an API that would let us implement the same strategy.
> >> Specifically,
> >> is there an API to get the byte[] from a MapMessage and to create a
> >> MapMessage from a byte[]?
> >> 
> >> Thanks in advance.
> > 
> > There's not a direct way of doing this via the NMS API but there are
> > some tricks that can allow you to get the byte[] from a MapMessage if
> > you really wanted to.  There is another option that might be better that
> > will be available in the NMS.AcitveMQ 1.2.0 release.  You can now set a
> > property on the Connection instance to enable compression and provide a
> > CompressionPolicy instance that defines the compression method used to
> > compress and decompress the body of a Message.  By default NMS.ActiveMQ
> > just uses the GZipStream built into .NET but if you want to actually
> > trade messages between Java and .NET then you'd need to use something
> > like the DotNetZip library which provides a ZlibStream class that can
> > compress and decompress in a format that's compatible with the Java
> > client's own compression format.
> > 
> > Regards
> > Tim.
> > 
> > -- 
> > Tim Bish
> > http://fusesource.com
> > http://timbish.blogspot.com/
> > 
> > 
> > 
> > 
> > 
> 
-- 
Tim Bish
http://fusesource.com
http://timbish.blogspot.com/




Mime
View raw message