public void MutateIncoming(NServiceBus.Unicast.Transport.TransportMessage transportMessage) { if (transportMessage.Is_Failed_Message()) { var failedMessage = transportMessage.To_NServiceBus_Failed_Message(); } var body = Encoding.UTF8.GetString(transportMessage.Body); var serializer = new XmlMessageSerializer(new MessageMapper()); using (var buffer = new MemoryStream()) { serializer.Serialize(new[] { new NServiceBus_Audit_Message { XmlBody = body, Headers = transportMessage.Headers.Select(p=> new Header{ Name= p.Key, Value = p.Value}).ToList(), Message_Id = transportMessage.Id, CorrelationId = transportMessage.CorrelationId, IdForCorrelation = transportMessage.IdForCorrelation, MessageIntent = transportMessage.MessageIntent +"", ReplyToAddress = transportMessage.ReplyToAddress.ToString(), TimeSent = transportMessage.TimeSent, } }, buffer); transportMessage.Body = buffer.GetBuffer(); } }
public void MutateOutgoing(object[] messages, NServiceBus.Unicast.Transport.TransportMessage transportMessage) { if (Bus.CurrentMessageContext == null || !Bus.CurrentMessageContext.Headers.ContainsKey("access_token")) return; transportMessage.Headers["access_token"] = Bus.CurrentMessageContext.Headers["access_token"]; }
void OnFailedMessageProcessing(object sender, NServiceBus.Unicast.Transport.FailedMessageProcessingEventArgs e) { Console.WriteLine("This is a first level retry attempt"); }
// message processing pipeline ordering public void SpecifyOrder(NServiceBus.Order order) { order.SpecifyFirst<First<AuthenticationHandler>>(); }
public void Serialize(NServiceBus.IMessage[] messages, System.IO.Stream stream) { DecoratedSerializer.Serialize(messages, stream); }
public Task Init(Func<MessageContext, Task> onMessage, Func<ErrorContext, Task<ErrorHandleResult>> onError, NServiceBus.CriticalError criticalError, PushSettings settings) { this.criticalError = criticalError; return Task.FromResult(0); }
public void MutateOutgoing(object[] messages, NServiceBus.Unicast.Transport.TransportMessage transportMessage) { transportMessage.Headers["access_token"] = HttpContext.Current.Request.Params["access_token"]; }
public void Unsubscribe(NServiceBus.Address client, IEnumerable<NServiceBus.Unicast.Subscriptions.MessageType> messageTypes) { throw new NotImplementedException(); }