Exemplo n.º 1
0
        public async Task ProcessRequest(Guid correlationId, RequestMessage request)
        {
            // TODO: Actually process the request...


            // Then send response back to transport layer
            OnRequestProcessed?.Invoke(this, new ResponseMessageEventArgs
            {
                CorrelationId = Guid.NewGuid(),
                Response      = new ResponseMessage
                {
                    Success = true,
                    Content = new byte[] { 0x0A, 0x0B }
                }
            });
        }
Exemplo n.º 2
0
        private void ProcessRequest(HttpListenerContext context)
        {
            try
            {
                OnRequestReceived.Execute(context);

                foreach (var processor in _processors)
                {
                    //when the first processor managed the request
                    //do not proceed with other processors
                    if (processor.IsNotNull() && processor.Process(context))
                    {
                        OnRequestProcessed.Execute(processor, context);
                        break;
                    }
                }
            }
            finally
            {
                //close the response
                context.Response.OutputStream.Close();
            }
        }