static Task SendMessage(this IBehaviorContext context, Type messageType, object message, SendOptions options) { var cache = context.Extensions.Get <IPipelineCache>(); var pipeline = cache.Pipeline <IOutgoingSendContext>(); var messageId = options.UserDefinedMessageId ?? CombGuid.Generate().ToString(); var headers = new Dictionary <string, string>(options.OutgoingHeaders) { [Headers.MessageId] = messageId }; var outgoingContext = new OutgoingSendContext( new OutgoingLogicalMessage(messageType, message), messageId, headers, options.Context, context); if (options.DelayedDeliveryConstraint != null) { // we can't add the constraints directly to the SendOptions ContextBag as the options can be reused // and the delivery constraints might be removed by the TimeoutManager logic. outgoingContext.AddDeliveryConstraint(options.DelayedDeliveryConstraint); } return(pipeline.Invoke(outgoingContext)); }
static Task SendMessage(this IBehaviorContext context, Type messageType, object message, SendOptions options) { var settings = context.Builder.Build <ReadOnlySettings>(); var pipeline = new PipelineBase <IOutgoingSendContext>(context.Builder, settings, settings.Get <PipelineConfiguration>().MainPipeline); var outgoingContext = new OutgoingSendContext( new OutgoingLogicalMessage(messageType, message), options, context); return(pipeline.Invoke(outgoingContext)); }
static Task SendMessage(this IBehaviorContext context, Type messageType, object message, SendOptions options) { var cache = context.Extensions.Get <IPipelineCache>(); var pipeline = cache.Pipeline <IOutgoingSendContext>(); var outgoingContext = new OutgoingSendContext( new OutgoingLogicalMessage(messageType, message), options, context); return(pipeline.Invoke(outgoingContext)); }
Task SendMessage(IBehaviorContext context, Type messageType, object message, SendOptions options) { var messageId = options.UserDefinedMessageId ?? CombGuid.Generate().ToString(); var headers = new Dictionary <string, string>(options.OutgoingHeaders) { [Headers.MessageId] = messageId }; var outgoingContext = new OutgoingSendContext( new OutgoingLogicalMessage(messageType, message), messageId, headers, options.Context, context); MergeDispatchProperties(outgoingContext, options.DispatchProperties); return(sendPipeline.Invoke(outgoingContext)); }
static Task SendMessage(this IBehaviorContext context, Type messageType, object message, SendOptions options) { var cache = context.Extensions.Get <IPipelineCache>(); var pipeline = cache.Pipeline <IOutgoingSendContext>(); var messageId = options.UserDefinedMessageId ?? CombGuid.Generate().ToString(); var headers = new Dictionary <string, string>(options.OutgoingHeaders) { [Headers.MessageId] = messageId }; var outgoingContext = new OutgoingSendContext( new OutgoingLogicalMessage(messageType, message), messageId, headers, options.Context, context); return(pipeline.Invoke(outgoingContext)); }