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; toSend.ScheduledEnqueueTimeUtc = sendOptions.ScheduledEnqueueTimeUtc; 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; toSend.ScheduledEnqueueTimeUtc = sendOptions.ScheduledEnqueueTimeUtc; 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(); }
private Task InvokeLogical(OutgoingLogicalContext context) { if (this.executingLogicalPipeline.Count == 0) { return(Task.FromResult(0)); } IOutgoingLogicalStep step = this.executingLogicalPipeline.Dequeue(); return(step.Invoke(context, () => this.InvokeLogical(context))); }
public virtual async Task Invoke(LogicalMessage outgoingLogicalMessage, DeliveryOptions options, EndpointConfiguration.ReadOnly configuration, TransportMessage incomingTransportMessage = null) { this.executingLogicalPipeline = new Queue <IOutgoingLogicalStep>(this.registeredlogicalPipelineSteps); var logicalContext = new OutgoingLogicalContext(outgoingLogicalMessage, options, configuration); logicalContext.SetChain(this); await this.InvokeLogical(logicalContext) .ConfigureAwait(false); // We assume that someone in the pipeline made transport message var outgoingTransportMessage = logicalContext.Get <TransportMessage>(); this.executingTransportPipeline = new Queue <IOutgoingTransportStep>(this.registeredTransportPipelineSteps); var transportContext = new OutgoingTransportContext(outgoingLogicalMessage, outgoingTransportMessage, options, configuration, incomingTransportMessage); transportContext.SetChain(this); await this.InvokeTransport(transportContext) .ConfigureAwait(false); }
public Task Invoke(OutgoingLogicalContext context, Func <Task> next) { var step = this.factory(); return(step.Invoke(context, next)); }
public virtual async Task Invoke(LogicalMessage outgoingLogicalMessage, DeliveryOptions options, EndpointConfiguration.ReadOnly configuration, TransportMessage incomingTransportMessage = null) { this.executingLogicalPipeline = new Queue<IOutgoingLogicalStep>(this.registeredlogicalPipelineSteps); var logicalContext = new OutgoingLogicalContext(outgoingLogicalMessage, options, configuration); logicalContext.SetChain(this); await this.InvokeLogical(logicalContext) .ConfigureAwait(false); // We assume that someone in the pipeline made transport message var outgoingTransportMessage = logicalContext.Get<TransportMessage>(); this.executingTransportPipeline = new Queue<IOutgoingTransportStep>(this.registeredTransportPipelineSteps); var transportContext = new OutgoingTransportContext(outgoingLogicalMessage, outgoingTransportMessage, options, configuration, incomingTransportMessage); transportContext.SetChain(this); await this.InvokeTransport(transportContext) .ConfigureAwait(false); }
public Task Invoke(OutgoingLogicalContext context, Func<Task> next) { var step = this.factory(); return step.Invoke(context, next); }
private Task InvokeLogical(OutgoingLogicalContext context) { if (this.executingLogicalPipeline.Count == 0) { return Task.FromResult(0); } IOutgoingLogicalStep step = this.executingLogicalPipeline.Dequeue(); return step.Invoke(context, () => this.InvokeLogical(context)); }