Пример #1
0
        public void Audit(SendOptions sendOptions, TransportMessage transportMessage)
        {
            // Revert the original body if needed (if any mutators were applied, forward the original body as received)
            transportMessage.RevertToOriginalBodyIfNeeded();

            // Create a new transport message which will contain the appropriate headers
            var messageToForward = new TransportMessage(transportMessage.Id, transportMessage.Headers)
            {
                Body = transportMessage.Body,
                Recoverable = transportMessage.Recoverable,
                TimeToBeReceived = sendOptions.TimeToBeReceived.HasValue ? sendOptions.TimeToBeReceived.Value : transportMessage.TimeToBeReceived
            };

            messageToForward.Headers[Headers.ProcessingMachine] = RuntimeEnvironment.MachineName;
            messageToForward.Headers[Headers.ProcessingEndpoint] = EndpointName;

            if (transportMessage.ReplyToAddress != null)
            {
                messageToForward.Headers[Headers.OriginatingAddress] = transportMessage.ReplyToAddress.ToString();
            }

            // Send the newly created transport message to the queue
            MessageSender.Send(messageToForward, new SendOptions(sendOptions.Destination)
            {
                ReplyToAddress = Configure.PublicReturnAddress
            });
        }
Пример #2
0
        public void Audit(SendOptions sendOptions, TransportMessage transportMessage)
        {
            // Revert the original body if needed (if any mutators were applied, forward the original body as received)
            transportMessage.RevertToOriginalBodyIfNeeded();

            // Create a new transport message which will contain the appropriate headers
            var messageToForward = new TransportMessage(transportMessage.Id, transportMessage.Headers)
            {
                Body             = transportMessage.Body,
                Recoverable      = transportMessage.Recoverable,
                TimeToBeReceived = sendOptions.TimeToBeReceived.HasValue ? sendOptions.TimeToBeReceived.Value : transportMessage.TimeToBeReceived
            };

            messageToForward.Headers[Headers.ProcessingMachine]  = RuntimeEnvironment.MachineName;
            messageToForward.Headers[Headers.ProcessingEndpoint] = EndpointName;

            if (transportMessage.ReplyToAddress != null)
            {
                messageToForward.Headers[Headers.OriginatingAddress] = transportMessage.ReplyToAddress.ToString();
            }

            // Send the newly created transport message to the queue
            MessageSender.Send(messageToForward, new SendOptions(sendOptions.Destination)
            {
                ReplyToAddress = Configure.PublicReturnAddress
            });
        }
Пример #3
0
        public void Audit( SendOptions sendOptions, TransportMessage message)
        {
            var context = PipelineExecutor.CurrentContext;

            OutboxMessage currentOutboxMessage;

            if (context.TryGet(out currentOutboxMessage))
            {
                message.RevertToOriginalBodyIfNeeded();
                
                currentOutboxMessage.TransportOperations.Add(new TransportOperation(message.Id, sendOptions.ToTransportOperationOptions(true), message.Body, message.Headers));
            }
            else
            {
                DefaultMessageAuditer.Audit(sendOptions, message);
            }
        }
Пример #4
0
        public void Audit(SendOptions sendOptions, TransportMessage message)
        {
            var context = PipelineExecutor.CurrentContext;

            OutboxMessage currentOutboxMessage;

            if (context.TryGet(out currentOutboxMessage))
            {
                message.RevertToOriginalBodyIfNeeded();

                currentOutboxMessage.TransportOperations.Add(new TransportOperation(message.Id, sendOptions.ToTransportOperationOptions(true), message.Body, message.Headers));
            }
            else
            {
                DefaultMessageAuditer.Audit(sendOptions, message);
            }
        }
Пример #5
0
        public static void ForwardMessage(this ISendMessages messageSender,  TransportMessage transportMessage, TimeSpan timeToBeReceived, Address address)
        {
            // Revert the original body if needed (if any mutators were applied, forward the original body as received)
            transportMessage.RevertToOriginalBodyIfNeeded();

            // Create a new transport message which will contain the appropriate headers
            var messageToForward = new TransportMessage(transportMessage.Id, transportMessage.Headers)
                                   {
                                       Body = transportMessage.Body,
                                       CorrelationId = transportMessage.CorrelationId,
                                       MessageIntent = transportMessage.MessageIntent,
                                       Recoverable = transportMessage.Recoverable,
                                       ReplyToAddress = Address.Local,
                                       TimeToBeReceived = timeToBeReceived == TimeSpan.Zero ? transportMessage.TimeToBeReceived : timeToBeReceived
                                   };
            if (transportMessage.ReplyToAddress != null)
            {
                messageToForward.Headers[Headers.OriginatingAddress] = transportMessage.ReplyToAddress.ToString();
            }

            // Send the newly created transport message to the queue
            messageSender.Send(messageToForward, address);
        }
Пример #6
0
        public static void ForwardMessage(this ISendMessages messageSender, TransportMessage transportMessage, TimeSpan timeToBeReceived, Address address)
        {
            // Revert the original body if needed (if any mutators were applied, forward the original body as received)
            transportMessage.RevertToOriginalBodyIfNeeded();

            // Create a new transport message which will contain the appropriate headers
            var messageToForward = new TransportMessage(transportMessage.Id, transportMessage.Headers)
            {
                Body             = transportMessage.Body,
                CorrelationId    = transportMessage.CorrelationId,
                MessageIntent    = transportMessage.MessageIntent,
                Recoverable      = transportMessage.Recoverable,
                ReplyToAddress   = Address.Local,
                TimeToBeReceived = timeToBeReceived == TimeSpan.Zero ? transportMessage.TimeToBeReceived : timeToBeReceived
            };

            if (transportMessage.ReplyToAddress != null)
            {
                messageToForward.Headers[Headers.OriginatingAddress] = transportMessage.ReplyToAddress.ToString();
            }

            // Send the newly created transport message to the queue
            messageSender.Send(messageToForward, address);
        }