activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jhakim <jawaid.ha...@codestreet.com>
Subject Re: Compression from provider to consumer
Date Thu, 10 Aug 2006 19:11:15 GMT

There is a great port of the JAVA compression package to .NET. Check out
http://www.icsharpcode.net/OpenSource/SharpZipLib/. 

Using the .NET port the uncompression is comething like:

		private static byte[] Inflate(byte[] bytes)
		{
			MemoryStream mis = new MemoryStream();
			mis.Write(bytes, 0, bytes.Length);
			mis.Flush();
			mis.Position = 0;
			Stream ins = new GZipInputStream(mis);

			MemoryStream mos = new MemoryStream();
			byte[] buf = new byte[102400];
			while (true)
			{
				int count = ins.Read(buf, 0, buf.Length);
				if (count == 0)
					break;
				mos.Write(buf, 0, count);
			}
			ins.Close();
			mos.Position = 0;
			byte[] uncompressedBytes = new byte[mos.Length];
			mos.Read(uncompressedBytes, 0, uncompressedBytes.Length);
			mos.Close();

			return uncompressedBytes;
		}


In the case of the bond trading sysetm that I am working on compression is
required only from the server (java) to client (.NET). I am sure that
compression code in .NET is pretty straightforward as well. 


James.Strachan wrote:
> 
> On 8/10/06, jhakim <jawaid.hakim@codestreet.com> wrote:
>>
>> I can answer that - yes. .NET has extensive built-in support for
>> compression.
> 
> Great - thanks. Do you fancy submitting some C# code to deal with
> compression? :)
> 
> James
> 
>>
>>
>> Hiram Chirino wrote:
>> >
>> > On 8/9/06, jhakim <jawaid.hakim@codestreet.com> wrote:
>> >>
>> >> Is compression of payload done only from publisher to JMS provider or
>> all
>> >> the
>> >> way from publisher to JMS provider to consumer?
>> >>
>> >
>> > publisher compresses and the consumer decompresses.  Broker just moves
>> > around a byte[] payload (he does not care if it's compressed or not).
>> >
>> >> If the answer is (as I would prefer it to be) that compression of
>> message
>> >> body is done all the way from publisher to client, then the follow up
>> >
>> > Yep.
>> >
>> >> question is whether or not compression is available (using NMS) if the
>> >> publisher is a Java process and the consumer is a C# process.
>> >
>> > I don't think the C# client supports payload compression and
>> > decompression yet.  This is one of the reasons that compression is off
>> > by default.  Anybody know of .NET has gzip compression algorithms
>> > included in the platform APIs?
>> >
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Compression-from-provider-to-consumer-tf2081319.html#a5734124
>> >> Sent from the ActiveMQ - User forum at Nabble.com.
>> >>
>> >>
>> >
>> >
>> > --
>> > Regards,
>> > Hiram
>> >
>> > Blog: http://hiramchirino.com
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Compression-from-provider-to-consumer-tf2081319.html#a5745175
>> Sent from the ActiveMQ - User forum at Nabble.com.
>>
>>
> 
> 
> -- 
> 
> James
> -------
> http://radio.weblogs.com/0112098/
> 
> 

-- 
View this message in context: http://www.nabble.com/Compression-from-provider-to-consumer-tf2081319.html#a5750569
Sent from the ActiveMQ - User forum at Nabble.com.


Mime
View raw message