Example #1
0
    public void MutateOutgoing(MutateOutgoingTransportMessagesContext context)
    {
        log.Info("transportMessage.Body size before compression: " + context.Body.Length);

        MemoryStream mStream   = new MemoryStream(context.Body);
        MemoryStream outStream = new MemoryStream();

        using (GZipStream tinyStream = new GZipStream(outStream, CompressionMode.Compress))
        {
            mStream.CopyTo(tinyStream);
        }
        // copy the compressed buffer only after the GZipStream is disposed,
        // otherwise, not all the compressed message will be copied.
        context.Body = outStream.ToArray();
        context.SetHeader("IWasCompressed", "true");
        log.Info("transportMessage.Body size after compression: " + context.Body.Length);
    }
    public void MutateOutgoing(MutateOutgoingTransportMessagesContext context)
    {
        

        log.Info("transportMessage.Body size before compression: " + context.Body.Length);

        MemoryStream mStream = new MemoryStream(context.Body);
        MemoryStream outStream = new MemoryStream();

        using (GZipStream tinyStream = new GZipStream(outStream, CompressionMode.Compress))
        {
            mStream.CopyTo(tinyStream);
        }
        // copy the compressed buffer only after the GZipStream is disposed, 
        // otherwise, not all the compressed message will be copied.
        context.Body = outStream.ToArray();
        context.SetHeader("IWasCompressed", "true");
        log.Info("transportMessage.Body size after compression: " + context.Body.Length);
    }
Example #3
0
 public void MutateOutgoing(MutateOutgoingTransportMessagesContext context)
 {
     context.SetHeader("Debug", Debug.ToString());
 }
 public void MutateOutgoing(MutateOutgoingTransportMessagesContext context)
 {
     context.Body = context.Body.Reverse().ToArray();
 }
Example #5
0
 public void MutateOutgoing(MutateOutgoingTransportMessagesContext context)
 {
     context.SetHeader("MyCustomHeader", "My custom value");
 }
 public void MutateOutgoing(MutateOutgoingTransportMessagesContext context)
 {
     context.SetHeader("Debug", Debug.ToString());
 }
 public void MutateOutgoing(MutateOutgoingTransportMessagesContext context)
 {
     context.Body = context.Body.Reverse().ToArray();
 }