class AWS::Flow::GenericWorker

A generic Activity/Workflow worker class.

Public Class Methods

new(service, domain, task_list_to_poll, *args, &block) click to toggle source

Creates a new ‘GenericWorker`. @param service

The AWS service class to use.

@param domain

The Amazon SWF domain to use.

@param task_list_to_poll

The list of tasks to poll for this worker.

@param args

Arguments for the workflow worker.

@param [WorkerOptions] block

A set of {WorkerOptions} for the worker.
# File lib/aws/decider/worker.rb, line 39
def initialize(service, domain, task_list_to_poll, *args, &block)
  @service = service
  @domain = domain
  @task_list = task_list_to_poll
  if args
    args.each { |klass_or_instance| add_implementation(klass_or_instance) }
  end
  @shutting_down = false
  %w{ TERM INT }.each do |signal|
    Signal.trap(signal) do
      if @shutting_down
        @executor.shutdown(0) if @executor
        Kernel.exit! 1
      else
        @shutting_down = true
        @shutdown_first_time_function.call if @shutdown_first_time_function
      end
    end
  end
end

Public Instance Methods

camel_case_to_snake_case(camel_case) click to toggle source

@api private

# File lib/aws/decider/worker.rb, line 61
def camel_case_to_snake_case(camel_case)
  camel_case.
    gsub(/(.)([A-Z])/,'\1_\2').
    downcase
end
resolve_default_task_list(name) click to toggle source
# File lib/aws/decider/worker.rb, line 67
def resolve_default_task_list(name)
  name == FlowConstants.use_worker_task_list ? @task_list : name
end