/// <inheritdoc />
        public override Task InvokeAsync(IncommingMessageContext context, Func <Task> next)
        {
            Logger.InfoFormat(
                "Received {0} of type {1} from {2}",
                context.Message.GetIntent(),
                context.Message.GetFullName(),
                context.Headers[HeaderKeys.Sender]);

            return(this.handlers[context.MessageIntent](context.Message));
        }
示例#2
0
        private Task InvokeIncommingMessageStepsAsync(IncommingMessageContext context)
        {
            if (!this.incommingMessageSteps.Any())
            {
                return(Task.CompletedTask);
            }

            var nextStep = this.incommingMessageSteps.Dequeue();

            return(nextStep.InvokeAsync(context, () => this.InvokeIncommingMessageStepsAsync(context)));
        }
示例#3
0
        /// <summary>
        /// Invokes the pipeline
        /// </summary>
        /// <param name="envelope">The envelope</param>
        public async Task InvokeAsync(Envelope envelope)
        {
            var envelopeContext = new IncommingEnvelopeContext(envelope, this.configuration);

            await this.InvokeIncommingEnvelopeStepsAsync(envelopeContext).ConfigureAwait(false);

            if (envelopeContext.Message == null)
            {
                return;
            }

            var messageContext = new IncommingMessageContext(
                envelopeContext.Message,
                envelopeContext.Envelope.Headers,
                this.configuration);

            await this.InvokeIncommingMessageStepsAsync(messageContext).ConfigureAwait(false);
        }
 public override Task InvokeAsync(IncommingMessageContext context, Func <Task> next)
 {
     this.HasBeenCalled = true;
     return(Task.CompletedTask);
 }