コード例 #1
0
        public async Task ReceivesSentMessageWhenTransactionIsCommitted()
        {
            using (var scope = new RebusTransactionScope())
            {
                await _transport.Send(QueueName, RecognizableMessage(), scope.TransactionContext);

                await scope.CompleteAsync();
            }

            using (var scope = new RebusTransactionScope())
            {
                var transportMessage = await _transport.Receive(scope.TransactionContext, _cancellationToken);

                await scope.CompleteAsync();

                AssertMessageIsRecognized(transportMessage);
            }
        }
コード例 #2
0
        public async Task ReceivesSentMessageWhenTransactionIsCommitted()
        {
            using (var context = new DefaultTransactionContext())
            {
                await _transport.Send(QueueName, RecognizableMessage(), context);

                await context.Complete();
            }

            using (var context = new DefaultTransactionContext())
            {
                var transportMessage = await _transport.Receive(context);

                await context.Complete();

                AssertMessageIsRecognized(transportMessage);
            }
        }