Module: Ntswf::Base
Instance Method Summary collapse
- #activity_name ⇒ Object
- #activity_task_lists ⇒ Object
- #activity_type ⇒ Object
- #configure(config) ⇒ Object
- #decision_task_list ⇒ Object
- #default_unit ⇒ Object
- #domain ⇒ Object
- #execution_id_prefix ⇒ Object
- #execution_version ⇒ Object
- #notify(message, params) ⇒ Object
-
#on_notify(proc = nil) {|error| ... } ⇒ Object
Configure a proc or block to be called on handled errors.
-
#parse_input(input) ⇒ Hash
Parse the options stored in a task’s input value.
-
#separator ⇒ String
Separator for composite workflow_id.
- #swf ⇒ AWS::SimpleWorkflow
- #workflow_name ⇒ Object
- #workflow_version ⇒ Object
Instance Method Details
#activity_name ⇒ Object
64 65 66 |
# File 'lib/ntswf/base.rb', line 64 def activity_name "master-activity" end |
#activity_task_lists ⇒ Object
72 73 74 |
# File 'lib/ntswf/base.rb', line 72 def activity_task_lists @config.activity_task_lists end |
#activity_type ⇒ Object
114 115 116 |
# File 'lib/ntswf/base.rb', line 114 def activity_type @activity_type ||= domain.activity_types[activity_name, workflow_version] end |
#configure(config) ⇒ Object
32 33 34 35 36 |
# File 'lib/ntswf/base.rb', line 32 def configure(config) @config = OpenStruct.new(config) autocomplete_task_list_names! raise_if_invalid_task_list end |
#decision_task_list ⇒ Object
76 77 78 79 |
# File 'lib/ntswf/base.rb', line 76 def decision_task_list @config.decision_task_list or raise Errors::InvalidArgument.new( "Missing decision task list configuration") end |
#default_unit ⇒ Object
81 82 83 |
# File 'lib/ntswf/base.rb', line 81 def default_unit @default_unit ||= @config.unit.to_s end |
#domain ⇒ Object
68 69 70 |
# File 'lib/ntswf/base.rb', line 68 def domain @domain ||= swf.domains[@config.domain] end |
#execution_id_prefix ⇒ Object
85 86 87 |
# File 'lib/ntswf/base.rb', line 85 def execution_id_prefix "#{isolation_id}#{@config.execution_id_prefix || default_unit}" end |
#execution_version ⇒ Object
89 90 91 |
# File 'lib/ntswf/base.rb', line 89 def execution_version @config.execution_version end |
#notify(message, params) ⇒ Object
104 105 106 107 |
# File 'lib/ntswf/base.rb', line 104 def notify(, params) log("#{.}\n #{.backtrace.join("\n ")}") if .kind_of? Exception @notify_callback.call(message: , params: params) if @notify_callback end |
#on_notify(proc = nil) {|error| ... } ⇒ Object
Configure a proc or block to be called on handled errors
44 45 46 |
# File 'lib/ntswf/base.rb', line 44 def on_notify(proc = nil, &block) @notify_callback = proc || block end |
#parse_input(input) ⇒ Hash
Parse the options stored in a task’s input value
97 98 99 100 101 102 |
# File 'lib/ntswf/base.rb', line 97 def parse_input(input) , legacy_params = JSON.parse(input) = {"name" => } unless .kind_of? Hash .merge!("params" => legacy_params) if legacy_params end |
#separator ⇒ String
Returns separator for composite workflow_id.
110 111 112 |
# File 'lib/ntswf/base.rb', line 110 def separator ";" end |
#swf ⇒ AWS::SimpleWorkflow
49 50 51 52 53 54 |
# File 'lib/ntswf/base.rb', line 49 def swf @swf ||= (@config.swf || AWS::SimpleWorkflow.new({ access_key_id: @config.access_key_id, secret_access_key: @config.secret_access_key, })) end |
#workflow_name ⇒ Object
56 57 58 |
# File 'lib/ntswf/base.rb', line 56 def workflow_name "master-workflow" end |
#workflow_version ⇒ Object
60 61 62 |
# File 'lib/ntswf/base.rb', line 60 def workflow_version "v1" end |