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 async Task Send(SendContext <T> context) { context.SourceAddress = _sourceAddress; if (_conversationId.HasValue) { context.ConversationId = _conversationId; } if (_correlationId.HasValue) { context.InitiatorId = _correlationId; } var publishContext = new PublishContextProxy <T>(context, context.Message); bool firstTime = Interlocked.CompareExchange(ref _context, publishContext, null) == null; await _publishPipe.Send(publishContext).ConfigureAwait(false); await _pipe.Send(publishContext).ConfigureAwait(false); if (firstTime) { await _observer.PrePublish(publishContext).ConfigureAwait(false); } }
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) { var publishContext = context.GetPayload <PublishContext <T> >(); await _publishPipe.Send(publishContext).ConfigureAwait(false); await _pipe.Send(context).ConfigureAwait(false); }
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); } }
public async Task Send(SendContext <T> context) { if (_consumeContext != null) { context.TransferConsumeContextHeaders(_consumeContext); } context.SourceAddress = _sourceAddress; var publishContext = new PublishContextProxy <T>(context, context.Message); var firstTime = Interlocked.CompareExchange(ref _context, publishContext, null) == null; await _publishPipe.Send(publishContext).ConfigureAwait(false); await _pipe.Send(publishContext).ConfigureAwait(false); if (firstTime) { await _observer.PrePublish(publishContext).ConfigureAwait(false); } }
public Task Send(SendContext context) { var proxy = new PublishContextProxy(context); return(_publishPipe.Send(proxy)); }