Class: Ntswf::Instance

Inherits:
Object
  • Object
show all
Defined in:
lib/ntswf/instance.rb

Instance Method Summary collapse

Constructor Details

#initialize(*modules, config) ⇒ Instance

Returns a new instance of Instance.

Parameters:

  • modules (DEFAULT_MODULES)

    A list of module names to include

  • config (Hash)

    A configuration with the following keys:

Options Hash (config):

  • :access_key_id (String)

    AWS credential (deprecated, should use swf option)

  • :activity_task_lists (Hash)

    The task list names for activities as hash (see also :unit)

  • :decision_task_list (String)

    The task list name for decisions

  • :domain (String)

    The SWF domain name

  • :execution_id_prefix (String) — default: value of :unit

    Workflow ID prefix (see Client#start_execution‘s :execution_id for allowed values)

  • :execution_version (Numeric)

    Value allowing clients to reject future execution versions

  • :isolation_file (String)

    Development/test option. A random ID is stored at the given path, and prepended to task list names and execution IDs.

  • :pidfile (String)

    A path receiving the current PID for looping methods. Causes exit, if overwritten by another process. See Worker#in_subprocess

  • :secret_access_key (String)

    AWS credential (deprecated, should use swf option)

  • :subprocess_retries (Numeric) — default: 0
  • :swf (AWS::SimpleWorkflow)

    AWS simple workflow object (created e.g. with AWS::SimpleWorkflow.new)

  • :unit (String)

    This worker/client’s activity task list key



8
9
10
11
12
13
14
15
16
17
# File 'lib/ntswf/instance.rb', line 8

def initialize(*args)
  symbols = args.grep Symbol
  configs = args - symbols
  instance_exec do
    module_names = symbols.map(&:to_s).map { |s| s.gsub(/(^|_)(.)/) { $2.upcase } }
    module_names = DEFAULT_MODULES if module_names.empty?
    module_names.each { |module_name| extend Ntswf::const_get module_name }
  end
  configure(configs.last || {})
end