Beispiel #1
0
        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());
                    }
                }
            });
        }
Beispiel #2
0
        public virtual async Task <InvokeResult> StartAsync()
        {
            /* ACME Listeners are dedicated port 80 listeners that only listen for very special requests to verify domain ownership
             * if we have a port 80 listener in addition to the AcmeListener, it will not be an AcmeListener and should have a
             * a listener queue */
            if (_inputMessageQueue == null)
            {
                throw new NullReferenceException("Input Message Queue is Null");
            }

            CreationDate = DateTime.Now;
            await StateChanged(PipelineModuleStatus.Running);

            var result = await _inputMessageQueue.StartListeningAsync();

            if (result.Successful)
            {
                WorkLoop();
            }

            return(result);
        }