public Task ExecuteAsync(OutgoingPipelineContext ctx, Func <Task> next)
        {
            var message = ctx.Load <Messages.Message>();

            message.Headers.Add(Messages.MessageHeaders.DestinationAddress, _destinationAddressProvider.Get(message.Body.GetType()));

            return(FuncInvoker.Invoke(next));
        }
예제 #2
0
        public Task ExecuteAsync(OutgoingPipelineContext ctx, Func <Task> next)
        {
            var message = ctx.Load <Messages.Message>();

            message.Headers[MessageHeaders.EventType] = MessageTypeConverters.GetTypeName(message.Body.GetType());

            return(FuncInvoker.Invoke(next));
        }
예제 #3
0
        public async Task ExecuteAsync(OutgoingPipelineContext ctx, Func <Task> next)
        {
            var message = ctx.Load <Messages.Message>();

            var dbMessage = await _dataStorage.StoreMessageToSendAsync(message.Body, message.Headers);

            Action callDispatcher = () => _dispatcher.EnqueueToPublish(message, dbMessage.Id);

            if (Transaction.Current != null)
            {
                Transactions.GenericTransaction.EnlistTransaction(
                    null,
                    callDispatcher,
                    null,
                    null
                    );
            }
            else
            {
                callDispatcher();
            }
        }