Class: AWS::Flow::GenericWorker

Inherits:
Object
  • Object
show all
Defined in:
aws-flow-ruby/aws-flow/lib/aws/decider/worker.rb

Overview

A generic Activity/Workflow worker class.

Direct Known Subclasses

ActivityWorker, WorkflowWorker

Instance Method Summary (collapse)

Constructor Details

- (GenericWorker) initialize(service, domain, task_list_to_poll, *args, &block)

Creates a new GenericWorker.

Parameters:

  • service

    The AWS service class to use.

  • domain

    The Amazon SWF domain to use.

  • task_list_to_poll

    The list of tasks to poll for this worker.

  • args

    Arguments for the workflow worker.

  • block (WorkerOptions)

    A set of WorkerOptions for the worker.



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'aws-flow-ruby/aws-flow/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

Instance Method Details

- (Object) resolve_default_task_list(name)



67
68
69
# File 'aws-flow-ruby/aws-flow/lib/aws/decider/worker.rb', line 67

def resolve_default_task_list(name)
  name == FlowConstants.use_worker_task_list ? @task_list : name
end