Class: TopologicalInventory::Providers::Common::Operations::Processor
Class Method Summary
collapse
Instance Method Summary
collapse
#topology_api, #update_task
#operation_status
Methods included from Logging
#logger
Constructor Details
#initialize(message, metrics) ⇒ Processor
Returns a new instance of Processor.
18
19
20
21
22
23
24
25
|
# File 'lib/topological_inventory/providers/common/operations/processor.rb', line 18
def initialize(message, metrics)
self.message = message
self.metrics = metrics
self.model, self.method = message.message.split(".")
self.params = message.payload["params"]
self.identity = message.payload["request_context"]
end
|
Class Method Details
.process!(message, metrics) ⇒ Object
14
15
16
|
# File 'lib/topological_inventory/providers/common/operations/processor.rb', line 14
def self.process!(message, metrics)
new(message, metrics).process
end
|
Instance Method Details
#process ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/topological_inventory/providers/common/operations/processor.rb', line 27
def process
logger.info(status_log_msg)
impl = operation_class&.new(params, identity, metrics)
if impl&.respond_to?(method)
with_time_measure do
result = impl.send(method)
logger.info(status_log_msg("Complete"))
result
end
else
logger.warn(status_log_msg("Not Implemented!"))
complete_task("not implemented") if params["task_id"]
operation_status[:not_implemented]
end
rescue StandardError, NotImplementedError => e
complete_task(e.message) if params["task_id"]
raise
end
|