Class: RubyReactor::AsyncRouter

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_reactor/async_router.rb

Class Method Summary collapse

Class Method Details

.perform_async(serialized_context, reactor_class_name = nil, intermediate_results: {}) ⇒ Object



5
6
7
8
# File 'lib/ruby_reactor/async_router.rb', line 5

def self.perform_async(serialized_context, reactor_class_name = nil, intermediate_results: {})
  job_id = SidekiqWorkers::Worker.perform_async(serialized_context, reactor_class_name)
  RubyReactor::AsyncResult.new(job_id: job_id, intermediate_results: intermediate_results)
end

.perform_in(delay, serialized_context, reactor_class_name = nil, intermediate_results: {}) ⇒ Object



10
11
12
13
# File 'lib/ruby_reactor/async_router.rb', line 10

def self.perform_in(delay, serialized_context, reactor_class_name = nil, intermediate_results: {})
  job_id = SidekiqWorkers::Worker.perform_in(delay, serialized_context, reactor_class_name)
  RubyReactor::AsyncResult.new(job_id: job_id, intermediate_results: intermediate_results)
end

.perform_map_collection_async(parent_context_id:, map_id:, parent_reactor_class_name:, step_name:, strict_ordering:, timeout:) ⇒ Object

rubocop:disable Metrics/ParameterLists



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/ruby_reactor/async_router.rb', line 59

def self.perform_map_collection_async(parent_context_id:, map_id:, parent_reactor_class_name:, step_name:,
                                      strict_ordering:, timeout:)
  RubyReactor::SidekiqWorkers::MapCollectorWorker.perform_async(
    {
      "parent_context_id" => parent_context_id,
      "map_id" => map_id,
      "parent_reactor_class_name" => parent_reactor_class_name,
      "step_name" => step_name,
      "strict_ordering" => strict_ordering,
      "timeout" => timeout
    }
  )
end

.perform_map_element_async(map_id:, element_id:, index:, serialized_inputs:, reactor_class_info:, strict_ordering:, parent_context_id:, parent_reactor_class_name:, step_name:, batch_size: nil, serialized_context: nil) ⇒ Object

rubocop:disable Metrics/ParameterLists



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/ruby_reactor/async_router.rb', line 16

def self.perform_map_element_async(map_id:, element_id:, index:, serialized_inputs:, reactor_class_info:,
                                   strict_ordering:, parent_context_id:, parent_reactor_class_name:, step_name:,
                                   batch_size: nil, serialized_context: nil)
  RubyReactor::SidekiqWorkers::MapElementWorker.perform_async(
    {
      "map_id" => map_id,
      "element_id" => element_id,
      "index" => index,
      "serialized_inputs" => serialized_inputs,
      "reactor_class_info" => reactor_class_info,
      "strict_ordering" => strict_ordering,
      "parent_context_id" => parent_context_id,
      "parent_reactor_class_name" => parent_reactor_class_name,
      "step_name" => step_name,
      "batch_size" => batch_size,
      "serialized_context" => serialized_context
    }
  )
end

.perform_map_element_in(delay, map_id:, element_id:, index:, serialized_inputs:, reactor_class_info:, strict_ordering:, parent_context_id:, parent_reactor_class_name:, step_name:, batch_size: nil, serialized_context: nil) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/ruby_reactor/async_router.rb', line 36

def self.perform_map_element_in(delay, map_id:, element_id:, index:, serialized_inputs:, reactor_class_info:,
                                strict_ordering:, parent_context_id:, parent_reactor_class_name:, step_name:,
                                batch_size: nil, serialized_context: nil)
  RubyReactor::SidekiqWorkers::MapElementWorker.perform_in(
    delay,
    {
      "map_id" => map_id,
      "element_id" => element_id,
      "index" => index,
      "serialized_inputs" => serialized_inputs,
      "reactor_class_info" => reactor_class_info,
      "strict_ordering" => strict_ordering,
      "parent_context_id" => parent_context_id,
      "parent_reactor_class_name" => parent_reactor_class_name,
      "step_name" => step_name,
      "batch_size" => batch_size,
      "serialized_context" => serialized_context
    }
  )
end

.perform_map_execution_async(map_id:, serialized_inputs:, reactor_class_info:, strict_ordering:, parent_context_id:, parent_reactor_class_name:, step_name:) ⇒ Object

rubocop:disable Metrics/ParameterLists



75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/ruby_reactor/async_router.rb', line 75

def self.perform_map_execution_async(map_id:, serialized_inputs:, reactor_class_info:, strict_ordering:,
                                     parent_context_id:, parent_reactor_class_name:, step_name:)
  RubyReactor::SidekiqWorkers::MapExecutionWorker.perform_async(
    {
      "map_id" => map_id,
      "serialized_inputs" => serialized_inputs,
      "reactor_class_info" => reactor_class_info,
      "strict_ordering" => strict_ordering,
      "parent_context_id" => parent_context_id,
      "parent_reactor_class_name" => parent_reactor_class_name,
      "step_name" => step_name
    }
  )
end