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); } }
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); } }
public AmqpTransactionEnlistment(Transaction transaction, IAmqpTransactionManager amqpTransactionManager, ServiceBusConnection serviceBusConnection) { this.transaction = transaction; this.amqpTransactionManager = amqpTransactionManager; this.serviceBusConnection = serviceBusConnection; }