public Task Invoke(OutgoingLogicalContext context, Func<Task> next)
        {
            DeliveryOptions options = context.Options;

            var toSend = new TransportMessage
            {
                MessageIntent = MessageIntent.Publish
            };
            var sendOptions = options as SendOptions;

            if (sendOptions != null)
            {
                toSend.MessageIntent = sendOptions is ReplyOptions ? MessageIntent.Reply : MessageIntent.Send;
                toSend.ReplyTo = sendOptions.ReplyToAddress;

                if (sendOptions.CorrelationId != null)
                {
                    toSend.CorrelationId = sendOptions.CorrelationId;
                }
            }

            foreach (var headerEntry in context.LogicalMessage.Headers)
            {
                toSend.Headers[headerEntry.Key] = headerEntry.Value;
            }

            context.Set(toSend);

            return next();
        }
        public Task Invoke(OutgoingLogicalContext context, Func <Task> next)
        {
            DeliveryOptions options = context.Options;

            var toSend = new TransportMessage
            {
                MessageIntent = MessageIntent.Publish
            };
            var sendOptions = options as SendOptions;

            if (sendOptions != null)
            {
                toSend.MessageIntent = sendOptions is ReplyOptions ? MessageIntent.Reply : MessageIntent.Send;
                toSend.ReplyTo       = sendOptions.ReplyToAddress;

                if (sendOptions.CorrelationId != null)
                {
                    toSend.CorrelationId = sendOptions.CorrelationId;
                }
            }

            foreach (var headerEntry in context.LogicalMessage.Headers)
            {
                toSend.Headers[headerEntry.Key] = headerEntry.Value;
            }

            context.Set(toSend);

            return(next());
        }
Esempio n. 3
0
        Task InvokeLogical(OutgoingLogicalContext context)
        {
            if (executingLogicalPipeline.Count == 0)
            {
                return(Task.FromResult(0));
            }

            IOutgoingLogicalStep step = executingLogicalPipeline.Dequeue();

            return(step.Invoke(context, () => InvokeLogical(context)));
        }
        public virtual async Task Invoke(LogicalMessage outgoingLogicalMessage, DeliveryOptions options, EndpointConfiguration.ReadOnly configuration, TransportMessage incomingTransportMessage = null)
        {
            executingLogicalPipeline = new Queue<IOutgoingLogicalStep>(registeredlogicalPipelineSteps);
            var logicalContext = new OutgoingLogicalContext(outgoingLogicalMessage, options, configuration);
            await InvokeLogical(logicalContext)
                .ConfigureAwait(false);

            // We assume that someone in the pipeline made transport message
            var outgoingTransportMessage = logicalContext.Get<TransportMessage>();

            executingTransportPipeline = new Queue<IOutgoingTransportStep>(registeredTransportPipelineSteps);
            var transportContext = new OutgoingTransportContext(outgoingLogicalMessage, outgoingTransportMessage, options, configuration, incomingTransportMessage);
            await InvokeTransport(transportContext)
                .ConfigureAwait(false);
        }
Esempio n. 5
0
        public virtual async Task Invoke(LogicalMessage outgoingLogicalMessage, DeliveryOptions options, EndpointConfiguration.ReadOnly configuration, TransportMessage incomingTransportMessage = null)
        {
            executingLogicalPipeline = new Queue <IOutgoingLogicalStep>(registeredlogicalPipelineSteps);
            var logicalContext = new OutgoingLogicalContext(outgoingLogicalMessage, options, configuration);

            await InvokeLogical(logicalContext)
            .ConfigureAwait(false);

            // We assume that someone in the pipeline made transport message
            var outgoingTransportMessage = logicalContext.Get <TransportMessage>();

            executingTransportPipeline = new Queue <IOutgoingTransportStep>(registeredTransportPipelineSteps);
            var transportContext = new OutgoingTransportContext(outgoingLogicalMessage, outgoingTransportMessage, options, configuration, incomingTransportMessage);

            await InvokeTransport(transportContext)
            .ConfigureAwait(false);
        }
Esempio n. 6
0
        Task InvokeLogical(OutgoingLogicalContext context)
        {
            if (executingLogicalPipeline.Count == 0)
            {
                return Task.FromResult(0);
            }

            IOutgoingLogicalStep step = executingLogicalPipeline.Dequeue();

            return step.Invoke(context, () => InvokeLogical(context));
        }
Esempio n. 7
0
            public Task Invoke(OutgoingLogicalContext context, Func<Task> next)
            {
                var step = factory();

                return step.Invoke(context, next);
            }
Esempio n. 8
0
 public Task Invoke(OutgoingLogicalContext context, Func<Task> next)
 {
     collector.Add(context.LogicalMessage);
     return next();
 }
Esempio n. 9
0
            public Task Invoke(OutgoingLogicalContext context, Func <Task> next)
            {
                var step = factory();

                return(step.Invoke(context, next));
            }