예제 #1
0
        static async Task Warmup(CancellationToken token, IAmqpTransactionManager manager)
        {
            while (!token.IsCancellationRequested)
            {
                var tx = new Transaction();
                await manager.EnlistAsync(tx, new ServiceBusConnection()).ConfigureAwait(false);

                manager.RemoveEnlistment(tx.TransactionInformation.LocalIdentifier);
            }
        }
예제 #2
0
        static async Task KeepBusy(CancellationToken token, IAmqpTransactionManager manager)
        {
            var random = new Random(Interlocked.Increment(ref seed));

            await Task.Delay(random.Next(10, 100)).ConfigureAwait(false);

            while (!token.IsCancellationRequested)
            {
                var tx = new Transaction();
                var serviceBusConnection = new ServiceBusConnection();
                await Task.WhenAll(manager.EnlistAsync(tx, serviceBusConnection), manager.EnlistAsync(tx, serviceBusConnection), manager.EnlistAsync(tx, serviceBusConnection));

                manager.RemoveEnlistment(tx.TransactionInformation.LocalIdentifier);
            }
        }
예제 #3
0
 public AmqpTransactionEnlistment(Transaction transaction, IAmqpTransactionManager amqpTransactionManager, ServiceBusConnection serviceBusConnection)
 {
     this.transaction            = transaction;
     this.amqpTransactionManager = amqpTransactionManager;
     this.serviceBusConnection   = serviceBusConnection;
 }