Module: Toiler

Defined in:
lib/toiler.rb,
lib/toiler/cli.rb,
lib/toiler/worker.rb,
lib/toiler/version.rb,
lib/toiler/aws/queue.rb,
lib/toiler/gcp/queue.rb,
lib/toiler/aws/message.rb,
lib/toiler/gcp/message.rb,
lib/toiler/actor/fetcher.rb,
lib/toiler/utils/logging.rb,
lib/toiler/actor/processor.rb,
lib/toiler/actor/supervisor.rb,
lib/toiler/utils/argument_parser.rb,
lib/toiler/utils/environment_loader.rb,
lib/toiler/actor/utils/actor_logging.rb

Overview

Toiler Version

Defined Under Namespace

Modules: Actor, Aws, Gcp, Utils, Worker Classes: CLI, Shutdown, WaitShutdown

Constant Summary collapse

VERSION =
'0.7.1'

Class Method Summary collapse

Class Method Details

.active_worker_class_registryObject



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/toiler.rb', line 41

def active_worker_class_registry
  active_queues = options[:active_queues]
  if active_queues
    active_queues.each_with_object({}) do |q, registry|
      worker = @worker_class_registry[q]
      if worker.nil?
        logger.warn "No worker assigned to queue: #{q}"
      else
        registry[q] = worker
      end
    end
  else
    @worker_class_registry
  end
end

.aws_clientObject

Returns the value of attribute aws_client.



26
27
28
# File 'lib/toiler.rb', line 26

def aws_client
  @aws_client
end

.aws_client=(value) ⇒ Object

Sets the attribute aws_client

Parameters:

  • value

    the value to set the attribute aws_client to.



26
27
28
# File 'lib/toiler.rb', line 26

def aws_client=(value)
  @aws_client = value
end

.default_optionsObject



73
74
75
76
77
78
79
80
81
# File 'lib/toiler.rb', line 73

def default_options
  {
    auto_visibility_timeout: false,
    deadline_extension: false,
    concurrency: 1,
    auto_delete: false,
    shutdown_timeout: 5
  }
end

.fetcher(queue) ⇒ Object



57
58
59
# File 'lib/toiler.rb', line 57

def fetcher(queue)
  fetchers["fetcher_#{queue}".to_sym]
end

.fetchersObject

Returns the value of attribute fetchers.



25
26
27
# File 'lib/toiler.rb', line 25

def fetchers
  @fetchers
end

.gcp_clientObject

Returns the value of attribute gcp_client.



26
27
28
# File 'lib/toiler.rb', line 26

def gcp_client
  @gcp_client
end

.gcp_client=(value) ⇒ Object

Sets the attribute gcp_client

Parameters:

  • value

    the value to set the attribute gcp_client to.



26
27
28
# File 'lib/toiler.rb', line 26

def gcp_client=(value)
  @gcp_client = value
end

.loggerObject



33
34
35
# File 'lib/toiler.rb', line 33

def logger
  Toiler::Utils::Logging.logger
end

.optionsObject

Returns the value of attribute options.



25
26
27
# File 'lib/toiler.rb', line 25

def options
  @options
end

.processor_pool(queue) ⇒ Object



65
66
67
# File 'lib/toiler.rb', line 65

def processor_pool(queue)
  processor_pools["processor_pool_#{queue}".to_sym]
end

.processor_poolsObject

Returns the value of attribute processor_pools.



25
26
27
# File 'lib/toiler.rb', line 25

def processor_pools
  @processor_pools
end

.queuesObject



37
38
39
# File 'lib/toiler.rb', line 37

def queues
  worker_class_registry.keys
end

.register_worker(queue, worker) ⇒ Object



83
84
85
# File 'lib/toiler.rb', line 83

def register_worker(queue, worker)
  @worker_class_registry[queue] = worker
end

.set_fetcher(queue, val) ⇒ Object



61
62
63
# File 'lib/toiler.rb', line 61

def set_fetcher(queue, val)
  fetchers["fetcher_#{queue}".to_sym] = val
end

.set_processor_pool(queue, val) ⇒ Object



69
70
71
# File 'lib/toiler.rb', line 69

def set_processor_pool(queue, val)
  processor_pools["processor_pool_#{queue}".to_sym] = val
end

.worker_class_registryObject

Returns the value of attribute worker_class_registry.



25
26
27
# File 'lib/toiler.rb', line 25

def worker_class_registry
  @worker_class_registry
end

.worker_class_registry=(val) ⇒ Object



87
88
89
# File 'lib/toiler.rb', line 87

def worker_class_registry=(val)
  @worker_class_registry = val
end