public Task Send <T>(SendContext <T> context) where T : class { var publishContext = context.GetPayload <PublishContext <T> >(); return(_publishPipe.Send(publishContext)); }
public async Task Send(SendContext <T> context) { context.SourceAddress = _sourceAddress; if (_consumeContext != null) { context.TransferConsumeContextHeaders(_consumeContext); } var publishContext = context.GetPayload <PublishContext <T> >(); var firstTime = Interlocked.CompareExchange(ref _context, publishContext, null) == null; await _publishPipe.Send(publishContext).ConfigureAwait(false); if (_pipe.IsNotEmpty()) { await _pipe.Send(publishContext).ConfigureAwait(false); } if (firstTime) { await _observer.PrePublish(publishContext).ConfigureAwait(false); } }
public Task SendFault <T>(SendContext <T> context, Exception exception) where T : class { var publishContext = context.GetPayload <PublishContext <T> >(); return(ForEachAsync(x => x.PublishFault(publishContext, exception))); }
public Task PostSend <T>(SendContext <T> context) where T : class { var publishContext = context.GetPayload <PublishContext <T> >(); return(ForEachAsync(x => x.PostPublish(publishContext))); }
public async Task Send(SendContext <T> context) { var publishContext = context.GetPayload <PublishContext <T> >(); await _publishPipe.Send(publishContext).ConfigureAwait(false); await _pipe.Send(context).ConfigureAwait(false); }
public Task Send(SendContext <T> context) { if (_delay > TimeSpan.Zero) { var delaySendContext = context.GetPayload <DelaySendContext>(); delaySendContext.Delay = _delay; } return(_pipe.IsNotEmpty() ? _pipe.Send(context) : Task.CompletedTask); }
public async Task Send(SendContext <T> context) { var publishContext = context.GetPayload <MessageSendContext <T> >(); publishContext.IsPublish = true; await _publishPipe.Send(publishContext).ConfigureAwait(false); if (_pipe.IsNotEmpty()) { await _pipe.Send(context).ConfigureAwait(false); } }
static void UpdateDeliveryContext(ConsumeContext context, SendContext sendContext, TimeSpan delay) { int?previousDeliveryCount = context.Headers.Get(MessageHeaders.RedeliveryCount, default(int?)); if (!previousDeliveryCount.HasValue) { previousDeliveryCount = 0; } sendContext.Headers.Set(MessageHeaders.RedeliveryCount, previousDeliveryCount.Value + 1); var rabbitSendContext = sendContext.GetPayload <RabbitMqSendContext>(); rabbitSendContext.SetTransportHeader("x-delay", (long)delay.TotalMilliseconds); }
public override Task Send(SendContext <T> context) { ScheduledMessageId = ScheduleTokenIdCache <T> .GetTokenId(context.Message, context.MessageId); var sqsSendContext = context.GetPayload <AmazonSqsSendContext>(); var delay = Math.Max(0, (_scheduledTime.Kind == DateTimeKind.Local ? _scheduledTime - DateTime.Now : _scheduledTime - DateTime.UtcNow).TotalSeconds); if (delay > 0) { sqsSendContext.DelaySeconds = (int)delay; } return(base.Send(context)); }
public override Task Send(SendContext <T> context) { ScheduledMessageId = ScheduleTokenIdCache <T> .GetTokenId(context.Message, context.MessageId); var rabbitSendContext = context.GetPayload <RabbitMqSendContext>(); var delay = Math.Max(0, (_scheduledTime.Kind == DateTimeKind.Local ? _scheduledTime - DateTime.Now : _scheduledTime - DateTime.UtcNow).TotalMilliseconds); if (delay > 0) { rabbitSendContext.SetTransportHeader("x-delay", (long)delay); } return(base.Send(context)); }
public async Task Send(SendContext <TMessage> context) { context.DestinationAddress ??= _endpoint._destinationAddress; context.SourceAddress ??= _endpoint._sourceAddress; // ReSharper disable once SuspiciousTypeConversion.Global if (_pipe is ISendContextPipe sendContextPipe) { await sendContextPipe.Send(context).ConfigureAwait(false); } var publishContext = context.GetPayload <PublishContext <TMessage> >(); await _endpoint._publishPipe.Send(publishContext).ConfigureAwait(false); if (_pipe.IsNotEmpty()) { await _pipe.Send(context).ConfigureAwait(false); } context.ConversationId ??= NewId.NextGuid(); }
static PublishContext MergeContext(PublishContext input, SendContext context) { return(context.GetPayload <PublishContext>()); }
static PublishContext <T> MergeContext <T>(PublishContext <T> input, SendContext context) where T : class { return(context.GetPayload <PublishContext <T> >()); }
public Task Send(SendContext <T> context, IPipe <SendContext <T> > next) { var rabbitMqSendContext = context.GetPayload <RabbitMqSendContext <T> >(); return(_filter.Send(rabbitMqSendContext, next)); }
static PublishContext <TMessage> MergeContext(PublishContext <TMessage> input, SendContext context) { return(context.GetPayload <PublishContext <TMessage> >()); }
public Task Send(SendContext <T> context, IPipe <SendContext <T> > next) { var serviceBusSendContext = context.GetPayload <ServiceBusSendContext <T> >(); return(_filter.Send(serviceBusSendContext, next)); }
public Task Send(SendContext <T> context) { var publishContext = context.GetPayload <PublishContext <T> >(); return(_pipe.Send(publishContext)); }