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 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)
        {
            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);
            }
        }
Esempio n. 4
0
 public Task PrePublish(PublishContext <T> context)
 {
     return(_observer.PrePublish(context));
 }