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.
49 50 51 52 53 |
# File 'lib/tdl/queue/queue_based_implementation_runner.rb', line 49 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
71 72 73 74 75 76 77 |
# File 'lib/tdl/queue/queue_based_implementation_runner.rb', line 71 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
79 80 81 82 83 84 85 |
# File 'lib/tdl/queue/queue_based_implementation_runner.rb', line 79 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
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/tdl/queue/queue_based_implementation_runner.rb', line 55 def process_next_request_from(remote_broker, request) @audit.start_line @audit.log(request) # Obtain response from user response = @processing_rules.get_response_for(request) @audit.log(response) # Act after_response(remote_broker, request, response) @audit.end_line prepare_for_next_request(remote_broker, response) end |