Exemple #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);
            }
        }
Exemple #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);
            }
        }