public Task Init(Func <MessageContext, Task> onMessage, Func <ErrorContext, Task <ErrorHandleResult> > onError, CriticalError criticalError, PushSettings settings) { circuitBreaker = new RepeatedFailuresOverTimeCircuitBreaker("AzureStorageQueue-MessagePump", TimeToWaitBeforeTriggering, ex => criticalError.Raise("Failed to receive message from Azure Storage Queue.", ex)); messageReceiver.PurgeOnStartup = settings.PurgeOnStartup; receiveStrategy = ReceiveStrategy.BuildReceiveStrategy(onMessage, onError, settings.RequiredTransactionMode, criticalError); return(messageReceiver.Init(settings.InputQueue, settings.ErrorQueue)); }
public Task Initialize(PushRuntimeSettings limitations, OnMessage onMessage, OnError onError, CancellationToken cancellationToken = default) { this.limitations = limitations; Logger.Debug($"Initializing MessageReceiver {Id}"); receiveStrategy = ReceiveStrategy.BuildReceiveStrategy(onMessage, onError, requiredTransactionMode, criticalErrorAction); return(azureMessageQueueReceiver.Init(receiveAddress, errorQueue, cancellationToken)); }