activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Bish <>
Subject Re: Creating message from byte[]
Date Tue, 24 Nov 2009 16:38:30 GMT
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.


Tim Bish

View raw message