コード例 #1
0
        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();
        }
コード例 #2
0
        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());
        }
コード例 #3
0
        Task InvokeLogical(OutgoingLogicalContext context)
        {
            if (executingLogicalPipeline.Count == 0)
            {
                return(Task.FromResult(0));
            }

            IOutgoingLogicalStep step = executingLogicalPipeline.Dequeue();

            return(step.Invoke(context, () => InvokeLogical(context)));
        }
コード例 #4
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);
        }
コード例 #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);
        }
コード例 #6
0
        Task InvokeLogical(OutgoingLogicalContext context)
        {
            if (executingLogicalPipeline.Count == 0)
            {
                return Task.FromResult(0);
            }

            IOutgoingLogicalStep step = executingLogicalPipeline.Dequeue();

            return step.Invoke(context, () => InvokeLogical(context));
        }
コード例 #7
0
            public Task Invoke(OutgoingLogicalContext context, Func<Task> next)
            {
                var step = factory();

                return step.Invoke(context, next);
            }
コード例 #8
0
 public Task Invoke(OutgoingLogicalContext context, Func<Task> next)
 {
     collector.Add(context.LogicalMessage);
     return next();
 }
コード例 #9
0
            public Task Invoke(OutgoingLogicalContext context, Func <Task> next)
            {
                var step = factory();

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