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"); }
private Maybe <Request> GetNextRequest(RemoteBroker remoteBroker, IResponse response) { if (response is FatalErrorResponse) { return(Maybe <Request> .None); } else { return(remoteBroker.Receive()); } }
private void AfterResponse(RemoteBroker remoteBroker, Request request, IResponse response) { if (response is FatalErrorResponse) { // Do nothing } else { remoteBroker.RespondTo(request, response); } }
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)); }
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();
public void AfterResponse(RemoteBroker remoteBroker, Request request, IResponse response) { }