/// <summary> /// Initializes the <see cref="IDequeueMessages" />. /// </summary> /// <param name="primaryAddress">The address to listen on.</param> /// <param name="transactionSettings"> /// The <see cref="TransactionSettings" /> to be used by <see cref="IDequeueMessages" />. /// </param> /// <param name="tryProcessMessage">Called when a message has been dequeued and is ready for processing.</param> /// <param name="endProcessMessage"> /// Needs to be called by <see cref="IDequeueMessages" /> after the message has been processed regardless if the /// outcome was successful or not. /// </param> public void Init(Address primaryAddress, TransactionSettings transactionSettings, Func<TransportMessage, bool> tryProcessMessage, Action<TransportMessage, Exception> endProcessMessage) { queuePurger.Purge(primaryAddress); secondaryReceiveSettings = secondaryReceiveConfiguration.GetSettings(primaryAddress.Queue); var receiveStrategy = receiveStrategyFactory.Create(transactionSettings, tryProcessMessage); primaryReceiver = new AdaptivePollingReceiver(receiveStrategy, new TableBasedQueue(primaryAddress, locaConnectionParams.Schema), endProcessMessage, circuitBreaker, transportNotifications); if (secondaryReceiveSettings.IsEnabled) { var secondaryQueue = new TableBasedQueue(SecondaryReceiveSettings.ReceiveQueue.GetTableName(), locaConnectionParams.Schema); secondaryReceiver = new AdaptivePollingReceiver(receiveStrategy, secondaryQueue, endProcessMessage, circuitBreaker, transportNotifications); } else { secondaryReceiver = new NullExecutor(); } }
/// <summary> /// Initializes the <see cref="IDequeueMessages" />. /// </summary> /// <param name="primaryAddress">The address to listen on.</param> /// <param name="transactionSettings"> /// The <see cref="TransactionSettings" /> to be used by <see cref="IDequeueMessages" />. /// </param> /// <param name="tryProcessMessage">Called when a message has been dequeued and is ready for processing.</param> /// <param name="endProcessMessage"> /// Needs to be called by <see cref="IDequeueMessages" /> after the message has been processed regardless if the /// outcome was successful or not. /// </param> public void Init(Address primaryAddress, TransactionSettings transactionSettings, Func <TransportMessage, bool> tryProcessMessage, Action <TransportMessage, Exception> endProcessMessage) { queuePurger.Purge(primaryAddress); secondaryReceiveSettings = secondaryReceiveConfiguration.GetSettings(primaryAddress.Queue); var receiveStrategy = receiveStrategyFactory.Create(transactionSettings, tryProcessMessage); primaryReceiver = new AdaptivePollingReceiver(receiveStrategy, new TableBasedQueue(primaryAddress, locaConnectionParams.Schema), endProcessMessage, circuitBreaker, transportNotifications); if (secondaryReceiveSettings.IsEnabled) { var secondaryQueue = new TableBasedQueue(SecondaryReceiveSettings.ReceiveQueue.GetTableName(), locaConnectionParams.Schema); secondaryReceiver = new AdaptivePollingReceiver(receiveStrategy, secondaryQueue, endProcessMessage, circuitBreaker, transportNotifications); } else { secondaryReceiver = new NullExecutor(); } }