lib/toiler.rb in toiler-0.1.5 vs lib/toiler.rb in toiler-0.2.0

- old
+ new

@@ -1,77 +1,48 @@ require 'aws-sdk' -require 'toiler/core_ext' -require 'toiler/message' -require 'toiler/queue' +require 'toiler/utils/environment_loader' +require 'toiler/utils/logging' +require 'toiler/utils/argument_parser' require 'toiler/worker' -require 'toiler/environment_loader' -require 'toiler/logging' require 'toiler/cli' require 'toiler/version' +# Main module module Toiler - @worker_registry = {} @worker_class_registry = {} @options = { aws: {} } + @fetchers = {} + @processor_pools = {} + attr_reader :worker_class_registry, :options, :fetchers, :processor_pools + module_function :worker_class_registry, :options, :fetchers, :processor_pools + module_function - def options - @options - end - def logger - Toiler::Logging.logger + Toiler::Utils::Logging.logger end - def worker_class_registry - @worker_class_registry - end - - def worker_registry - @worker_registry - end - def queues - @worker_registry.keys + worker_class_registry.keys end def fetcher(queue) - Celluloid::Actor["fetcher_#{queue}".to_sym] + fetchers["fetcher_#{queue}".to_sym] end def set_fetcher(queue, val) - Celluloid::Actor["fetcher_#{queue}".to_sym] = val + fetchers["fetcher_#{queue}".to_sym] = val end def processor_pool(queue) - Celluloid::Actor["processor_pool_#{queue}".to_sym] + processor_pools["processor_pool_#{queue}".to_sym] end def set_processor_pool(queue, val) - Celluloid::Actor["processor_pool_#{queue}".to_sym] = val - end - - def scheduler(queue) - Celluloid::Actor["scheduler_#{queue}".to_sym] - end - - def manager - Celluloid::Actor[:manager] - end - - def set_manager(val) - Celluloid::Actor[:manager] = val - end - - def timer - Celluloid::Actor[:timer] - end - - def set_timer(val) - Celluloid::Actor[:timer] = val + processor_pools["processor_pool_#{queue}".to_sym] = val end def default_options { auto_visibility_timeout: false,