Class: TDL::Client::ApplyProcessingRules

Inherits:
Object
  • Object
show all
Defined in:
lib/tdl/client.rb

Overview

~~~~ Queue handling policies

Instance Method Summary collapse

Constructor Details

#initialize(processing_rules) ⇒ ApplyProcessingRules

Returns a new instance of ApplyProcessingRules.



43
44
45
46
47
# File 'lib/tdl/client.rb', line 43

def initialize(processing_rules)
  @processing_rules = processing_rules
  @logger = Logging.logger[self]
  @audit = AuditStream.new
end

Instance Method Details

#process_next_request_from(remote_broker, request) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/tdl/client.rb', line 49

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)

  # Obtain action
  client_action = response.client_action

  # Act
  client_action.after_response(remote_broker, request, response)
  @audit.log(client_action)
  @audit.end_line
  client_action.prepare_for_next_request(remote_broker)
end