Exemplo n.º 1
0
        public void Run()
        {
            audit.LogLine("Starting client");

            try
            {
                using (var remoteBroker = new RemoteBroker(
                           config.Hostname,
                           config.Port,
                           config.RequestQueueName,
                           config.ResponseQueueName,
                           config.RequestTimeoutMilliseconds))
                {
                    audit.LogLine("Waiting for requests");
                    var request = remoteBroker.Receive();
                    while (request.HasValue)
                    {
                        request = ApplyProcessingRules(request.Value, deployProcessingRules, remoteBroker);
                    }
                }
            }
            catch (Exception ex)
            {
                audit.LogException("There was a problem processing messages", ex);
            }

            audit.LogLine("Stopping client");
        }
Exemplo n.º 2
0
 private Maybe <Request> GetNextRequest(RemoteBroker remoteBroker, IResponse response)
 {
     if (response is FatalErrorResponse)
     {
         return(Maybe <Request> .None);
     }
     else
     {
         return(remoteBroker.Receive());
     }
 }
Exemplo n.º 3
0
 private void AfterResponse(RemoteBroker remoteBroker, Request request, IResponse response)
 {
     if (response is FatalErrorResponse)
     {
         // Do nothing
     }
     else
     {
         remoteBroker.RespondTo(request, response);
     }
 }
Exemplo n.º 4
0
        private Maybe <Request> ApplyProcessingRules(
            Request request,
            ProcessingRules processingRules,
            RemoteBroker remoteBroker)
        {
            audit.StartLine();
            audit.Log(request);

            var response = processingRules.GetResponseFor(request);

            audit.Log(response);

            audit.EndLine();

            AfterResponse(remoteBroker, request, response);

            return(GetNextRequest(remoteBroker, response));
        }
Exemplo n.º 5
0
        public void GoLiveWith(ProcessingRules processingRules)
        {
            audit.LogLine("Starting client");

            try
            {
                using (var remoteBroker = new RemoteBroker(hostname, port, uniqueId, TimeToWaitForRequests))
                {
                    audit.LogLine("Waiting for requests");
                    var request = remoteBroker.Receive();
                    while (request.HasValue)
                    {
                        request = ApplyProcessingRules(request.Value, processingRules, remoteBroker);
                    }
                }
            }
            catch (Exception ex)
            {
                audit.LogException("There was a problem processing messages", ex);
            }

            audit.LogLine("Stopping client");
        }
 public Maybe <Request> GetNextRequest(RemoteBroker remoteBroker) => Maybe <Request> .None;
 public void AfterResponse(RemoteBroker remoteBroker, Request request, IResponse response)
 {
     remoteBroker.RespondTo(request, response);
 }
 public Maybe <Request> GetNextRequest(RemoteBroker remoteBroker) => remoteBroker.Receive();
Exemplo n.º 9
0
 public void AfterResponse(RemoteBroker remoteBroker, Request request, IResponse response)
 {
 }