private void WorkLoop() { Task.Run(async() => { while (Status == PipelineModuleStatus.Running) { var msg = await _inputMessageQueue.ReceiveAsync(); /* queue will return a null message when it's "turned off", should probably change the logic to use cancellation tokens, not today though KDW 5/3/2017 */ //TODO Use cancellation token rather than return null when queue is no longer listenting. if (msg != null) { Execute(msg); } } }); }
protected void WorkLoop() { Task.Run(async() => { await _outgoingMessageQueue.StartListeningAsync(); while (Status == PipelineModuleStatus.Running || Status == PipelineModuleStatus.Listening) { var msg = await _outgoingMessageQueue.ReceiveAsync(); /* queue will return a null message when it's "turned off", should probably change the logic to use cancellation tokens, not today though KDW 5/3/2017 */ //TODO Use cancellation token rather than return null when queue is no longer listenting. // don't have the ACME listener process the message, even though it will likely do nothing. if (msg != null && _listenerConfiguration.RESTListenerType != RESTListenerTypes.AcmeListener) { await SendResponseAsync(msg, msg.OutgoingMessages.First()); } } }); }