public Task Init(Func <MessageContext, Task> onMessage, Func <ErrorContext, Task <ErrorHandleResult> > onError, CriticalError criticalError, PushSettings settings) { this.onMessage = onMessage; this.onError = onError; this.criticalError = criticalError; transactionMode = settings.RequiredTransactionMode; PathChecker.ThrowForBadPath(settings.InputQueue, "InputQueue"); messagePumpBasePath = Path.Combine(basePath, settings.InputQueue); bodyDir = Path.Combine(messagePumpBasePath, BodyDirName); delayedDir = Path.Combine(messagePumpBasePath, DelayedDirName); pendingTransactionDir = Path.Combine(messagePumpBasePath, PendingDirName); committedTransactionDir = Path.Combine(messagePumpBasePath, CommittedDirName); if (settings.PurgeOnStartup) { if (Directory.Exists(messagePumpBasePath)) { Directory.Delete(messagePumpBasePath, true); } } delayedMessagePoller = new DelayedMessagePoller(messagePumpBasePath, delayedDir); return(Task.CompletedTask); }
public void Init() { PathChecker.ThrowForBadPath(receiveSettings.ReceiveAddress, "InputQueue"); messagePumpBasePath = Path.Combine(basePath, receiveSettings.ReceiveAddress); bodyDir = Path.Combine(messagePumpBasePath, BodyDirName); delayedDir = Path.Combine(messagePumpBasePath, DelayedDirName); pendingTransactionDir = Path.Combine(messagePumpBasePath, PendingDirName); committedTransactionDir = Path.Combine(messagePumpBasePath, CommittedDirName); if (receiveSettings.PurgeOnStartup) { if (Directory.Exists(messagePumpBasePath)) { Directory.Delete(messagePumpBasePath, true); } } delayedMessagePoller = new DelayedMessagePoller(messagePumpBasePath, delayedDir); }