Class: TDL::QueueBasedImplementationRunner::ApplyProcessingRules
- Inherits:
-
Object
- Object
- TDL::QueueBasedImplementationRunner::ApplyProcessingRules
- Defined in:
- lib/tdl/queue/queue_based_implementation_runner.rb
Instance Method Summary collapse
- #after_response(remote_broker, request, response) ⇒ Object
-
#initialize(processing_rules) ⇒ ApplyProcessingRules
constructor
A new instance of ApplyProcessingRules.
- #prepare_for_next_request(remote_broker, response) ⇒ Object
- #process_next_request_from(remote_broker, request) ⇒ Object
Constructor Details
#initialize(processing_rules) ⇒ ApplyProcessingRules
Returns a new instance of ApplyProcessingRules.
54 55 56 57 58 |
# File 'lib/tdl/queue/queue_based_implementation_runner.rb', line 54 def initialize(processing_rules) @processing_rules = processing_rules @logger = Logging.logger[self] @audit = AuditStream.new end |
Instance Method Details
#after_response(remote_broker, request, response) ⇒ Object
77 78 79 80 81 82 83 |
# File 'lib/tdl/queue/queue_based_implementation_runner.rb', line 77 def after_response(remote_broker, request, response) if response.instance_of? FatalErrorResponse # Do nothing else remote_broker.respond_to(request, response) end end |
#prepare_for_next_request(remote_broker, response) ⇒ Object
85 86 87 88 89 90 91 |
# File 'lib/tdl/queue/queue_based_implementation_runner.rb', line 85 def prepare_for_next_request(remote_broker, response) if response.instance_of? FatalErrorResponse remote_broker.close else # Do nothing end end |
#process_next_request_from(remote_broker, request) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/tdl/queue/queue_based_implementation_runner.rb', line 61 def process_next_request_from(remote_broker, request) @audit.start_line @audit.log_request(request) # Obtain response from user response = @processing_rules.get_response_for(request) @audit.log_response(response) # Act after_response(remote_broker, request, response) @audit.end_line prepare_for_next_request(remote_broker, response) end |