Class: Aws::ActiveJob::SQS::Poller
- Inherits:
-
Object
- Object
- Aws::ActiveJob::SQS::Poller
- Defined in:
- lib/aws/active_job/sqs/poller.rb
Overview
CLI runner for polling for SQS ActiveJobs Use ‘aws_active_job_sqs –help` for detailed usage
Defined Under Namespace
Classes: Interrupt
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Poller
constructor
A new instance of Poller.
- #run ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Poller
Returns a new instance of Poller.
14 15 16 17 |
# File 'lib/aws/active_job/sqs/poller.rb', line 14 def initialize( = {}) @queues = .delete(:queues) @options = end |
Instance Method Details
#run ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/aws/active_job/sqs/poller.rb', line 19 def run init_config config = Aws::ActiveJob::SQS.config Signal.trap('INT') { raise Interrupt } Signal.trap('TERM') { raise Interrupt } @executor = Executor.new( max_threads: config.threads, logger: @logger, max_queue: config.backpressure, error_handler: config.poller_error_handler ) poll rescue Interrupt @logger.info 'Process Interrupted or killed - attempting to shutdown cleanly.' shutdown(config.shutdown_timeout) exit end |