public async Task <IQueueListener> CreateAsync(IQueueListenerFactory listenerFactory, HandlerDelegate handlerDelegate, IExceptionHandler exceptionHandler) { return(await listenerFactory.CreateAzureStorageQueueListener(this, handlerDelegate, exceptionHandler)); }
public static async Task <AzureStorageQueueListener> CreateAzureStorageQueueListener(this IQueueListenerFactory listenerFactory, AzureStorageQueueDefinition definition, HandlerDelegate handlerDelegate, IExceptionHandler exceptionHandler) { var storageAccount = CloudStorageAccount.Parse(definition.ConnectionString); var queueClient = storageAccount.CreateCloudQueueClient(); var queue = queueClient.GetQueueReference(definition.QueueName); var poisonQueue = queueClient.GetQueueReference(definition.PoisonQueueName); await queue.CreateIfNotExistsAsync(); await poisonQueue.CreateIfNotExistsAsync(); return(new AzureStorageQueueListener(queue, poisonQueue, new ExponentialBackoffDelayStrategy(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(10), 2), handlerDelegate, exceptionHandler)); }