public void RunConsumer(QueueConnection queueConnection, bool addInterceptors, ILogger logProvider, int runTime, int messageCount, int workerCount, int timeOut, Action <IContainer> badQueueAdditions, TimeSpan heartBeatTime, TimeSpan heartBeatMonitorTime, string updateTime, string route, bool enableChaos, ICreationScope scope) { _queueConnection = queueConnection; _workerCount = workerCount; _runTime = runTime; _badQueueAdditions = badQueueAdditions; _heartBeatTime = heartBeatTime; _heartBeatMonitorTime = heartBeatMonitorTime; _queue = CreateConsumerInternalThread(updateTime, route); var t = new Thread(RunBadQueue); t.Start(); if (enableChaos) { timeOut *= 2; } //run consumer RunConsumerInternal(queueConnection, addInterceptors, logProvider, runTime, messageCount, workerCount, timeOut, _queue, heartBeatTime, heartBeatMonitorTime, updateTime, route, enableChaos, scope); }
/// <summary> /// Initializes a new instance of the <see cref="ConsumerMethodQueue"/> class. /// </summary> /// <param name="queue">The queue.</param> /// <param name="log">The log.</param> /// <param name="messageMethodHandling">The message method handling.</param> public ConsumerMethodQueue( IConsumerQueue queue, ILogFactory log, IMessageMethodHandling messageMethodHandling) : base(log) { Guard.NotNull(() => queue, queue); Guard.NotNull(() => messageMethodHandling, messageMethodHandling); _queue = queue; _messageMethodHandling = messageMethodHandling; }
private static async Task DequeueLoopAsync(IConsumerQueue<int> queue, CancellationToken token) { await Task.Yield(); int previous = 0; try { while (!token.IsCancellationRequested) { int current = await queue.DequeueAsync(); if (current - previous != 1) { throw GetOutOfOrderError(current, previous); } previous = current; } } catch (ObjectDisposedException) { } }
public void RunConsumer(string queueName, string connectionString, bool addInterceptors, ILogProvider logProvider, int runTime, int messageCount, int workerCount, int timeOut, Action <IContainer> badQueueAdditions, TimeSpan heartBeatTime, TimeSpan heartBeatMonitorTime, string updateTime, string route) { _queueName = queueName; _connectionString = connectionString; _workerCount = workerCount; _runTime = runTime; _badQueueAdditions = badQueueAdditions; _heartBeatTime = heartBeatTime; _heartBeatMonitorTime = heartBeatMonitorTime; _queue = CreateConsumerInternalThread(updateTime, route); var t = new Thread(RunBadQueue); t.Start(); //run consumer RunConsumerInternal(queueName, connectionString, addInterceptors, logProvider, runTime, messageCount, workerCount, timeOut, _queue, heartBeatTime, heartBeatMonitorTime, updateTime, route); }
private static async Task DequeueLoopAsync(IConsumerQueue <int> queue, CancellationToken token) { await Task.Yield(); int previous = 0; try { while (!token.IsCancellationRequested) { int current = await queue.DequeueAsync(); if (current - previous != 1) { throw GetOutOfOrderError(current, previous); } previous = current; } } catch (ObjectDisposedException) { } }