Module: Ntswf::Base
Instance Method Summary collapse
- #activity_task_list ⇒ Object
- #activity_task_lists ⇒ Object
- #activity_type ⇒ Object
- #configure(config) ⇒ Object
- #decision_task_list ⇒ Object
- #default_unit ⇒ Object
- #domain ⇒ 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_task_list ⇒ Object
67 68 69 |
# File 'lib/ntswf/base.rb', line 67 def activity_task_list activity_task_lists[default_unit] or raise "Missing activity task list configuration" end |
#activity_task_lists ⇒ Object
59 60 61 |
# File 'lib/ntswf/base.rb', line 59 def activity_task_lists @config.activity_task_lists end |
#activity_type ⇒ Object
100 101 102 |
# File 'lib/ntswf/base.rb', line 100 def activity_type @activity_type ||= domain.activity_types[activity_name, workflow_version] end |
#configure(config) ⇒ Object
25 26 27 28 29 |
# File 'lib/ntswf/base.rb', line 25 def configure(config) @config = OpenStruct.new(config) autocomplete_task_list_names! raise_if_invalid_task_list end |
#decision_task_list ⇒ Object
63 64 65 |
# File 'lib/ntswf/base.rb', line 63 def decision_task_list @config.decision_task_list or raise "Missing decision task list configuration" end |
#default_unit ⇒ Object
71 72 73 |
# File 'lib/ntswf/base.rb', line 71 def default_unit @default_unit ||= @config.unit.to_s end |
#domain ⇒ Object
55 56 57 |
# File 'lib/ntswf/base.rb', line 55 def domain @domain ||= swf.domains[@config.domain] end |
#execution_version ⇒ Object
75 76 77 |
# File 'lib/ntswf/base.rb', line 75 def execution_version @config.execution_version end |
#notify(message, params) ⇒ Object
90 91 92 93 |
# File 'lib/ntswf/base.rb', line 90 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
37 38 39 |
# File 'lib/ntswf/base.rb', line 37 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
83 84 85 86 87 88 |
# File 'lib/ntswf/base.rb', line 83 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.
96 97 98 |
# File 'lib/ntswf/base.rb', line 96 def separator ";" end |
#swf ⇒ AWS::SimpleWorkflow
42 43 44 45 |
# File 'lib/ntswf/base.rb', line 42 def swf @swf ||= AWS::SimpleWorkflow.new(access_key_id: @config.access_key_id, secret_access_key: @config.secret_access_key, use_ssl: true) end |
#workflow_name ⇒ Object
47 48 49 |
# File 'lib/ntswf/base.rb', line 47 def workflow_name "#{default_unit}-workflow" end |
#workflow_version ⇒ Object
51 52 53 |
# File 'lib/ntswf/base.rb', line 51 def workflow_version "v1" end |