Class: TDL::QueueBasedImplementationRunner
- Inherits:
-
Object
- Object
- TDL::QueueBasedImplementationRunner
show all
- Defined in:
- lib/tdl/queue/queue_based_implementation_runner.rb
Defined Under Namespace
Classes: ApplyProcessingRules
Instance Method Summary
collapse
Constructor Details
Returns a new instance of QueueBasedImplementationRunner.
8
9
10
11
12
13
|
# File 'lib/tdl/queue/queue_based_implementation_runner.rb', line 8
def initialize(config, deploy_processing_rules)
@config = config
@deploy_processing_rules = deploy_processing_rules
@logger = Logging.logger[self]
@total_processing_time = nil
end
|
Instance Method Details
#get_request_timeout_millis ⇒ Object
39
40
41
|
# File 'lib/tdl/queue/queue_based_implementation_runner.rb', line 39
def get_request_timeout_millis
@config.get_time_to_wait_for_requests
end
|
#run ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/tdl/queue/queue_based_implementation_runner.rb', line 15
def run
time1 = Time.now.to_f
begin
@logger.info 'Starting client'
remote_broker = RemoteBroker.new(
@config.get_hostname,
@config.get_port,
@config.get_request_queue_name,
@config.get_response_queue_name,
@config.get_time_to_wait_for_requests)
remote_broker.subscribe(ApplyProcessingRules.new(@deploy_processing_rules))
@logger.info 'Waiting for requests.'
remote_broker.join
@logger.info 'Stopping client'
rescue Exception => e
@logger.error "There was a problem processing messages. #{e.message}"
@logger.error e.backtrace.join("\n")
end
time2 = Time.now.to_f
@total_processing_time = (time2 - time1) * 1000.00
end
|
#total_processing_time ⇒ Object
43
44
45
|
# File 'lib/tdl/queue/queue_based_implementation_runner.rb', line 43
def total_processing_time
@total_processing_time
end
|