Module: Aws::ActiveJob::SQS::CliOptions Private
- Defined in:
- lib/aws/active_job/sqs/cli_options.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
options for the aws_active_job_sqs CLI.
Class Method Summary collapse
- .backpressure_option(opts, out) ⇒ Object private
- .boot_rails_option(opts, out) ⇒ Object private
- .max_messages_option(opts, out) ⇒ Object private
- .parse(argv) ⇒ Object private
- .queues_option(opts, out) ⇒ Object private
- .require_option(opts, out) ⇒ Object private
- .shutdown_timeout_option(opts, out) ⇒ Object private
- .threads_option(opts, out) ⇒ Object private
- .visibility_timeout_option(opts, out) ⇒ Object private
Class Method Details
.backpressure_option(opts, out) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
83 84 85 86 87 88 89 90 91 |
# File 'lib/aws/active_job/sqs/cli_options.rb', line 83 def self.backpressure_option(opts, out) doc = 'The maximum number of messages to have waiting in ' \ 'the Executor queue. This should be a low, but non zero number. ' \ 'Messages in the Executor queue cannot be picked up by other ' \ 'processes and will slow down shutdown.' opts.on('-b', '--backpressure INTEGER', Integer, doc) do |a| out[:backpressure] = a end end |
.boot_rails_option(opts, out) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
47 48 49 50 51 52 |
# File 'lib/aws/active_job/sqs/cli_options.rb', line 47 def self.boot_rails_option(opts, out) doc = 'When set boots rails before running the poller.' opts.on('--[no-]rails [FLAG]', TrueClass, doc) do |a| out[:boot_rails] = a.nil? ? true : a end end |
.max_messages_option(opts, out) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
76 77 78 79 80 81 |
# File 'lib/aws/active_job/sqs/cli_options.rb', line 76 def self.(opts, out) doc = 'Max number of messages to receive in a batch from SQS.' opts.on('-m', '--max_messages INTEGER', Integer, doc) do |a| out[:max_messages] = a end end |
.parse(argv) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/aws/active_job/sqs/cli_options.rb', line 25 def self.parse(argv) out = { boot_rails: true, queues: [] } parser = option_parser(out) parser. = 'aws_active_job_sqs [options]' parser.on_tail '-h', '--help', 'Show help' do puts parser exit 1 end parser.parse(argv) out end |
.queues_option(opts, out) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
101 102 103 104 105 106 107 108 |
# File 'lib/aws/active_job/sqs/cli_options.rb', line 101 def self.queues_option(opts, out) doc = 'Queue(s) to poll. You may specify this argument multiple ' \ 'times to poll multiple queues. If not specified, will ' \ 'start pollers for all queues defined.' opts.on('-q', '--queue STRING', doc) do |a| out[:queues] << a.to_sym end end |
.require_option(opts, out) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 42 43 44 45 |
# File 'lib/aws/active_job/sqs/cli_options.rb', line 39 def self.require_option(opts, out) doc = 'Additional file to require before starting the poller. ' \ 'Can be used to define/load job classes with --no-rails.' opts.on('-r', '--require STRING', String, doc) do |a| out[:require] = a end end |
.shutdown_timeout_option(opts, out) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
54 55 56 57 58 59 60 61 |
# File 'lib/aws/active_job/sqs/cli_options.rb', line 54 def self.shutdown_timeout_option(opts, out) doc = 'The amount of time to wait for a clean shutdown. Jobs that ' \ 'are unable to complete in this time will not be deleted from ' \ 'the SQS queue and will be retryable after the visibility timeout.' opts.on('-s', '--shutdown_timeout INTEGER', Integer, doc) do |a| out[:shutdown_timeout] = a end end |
.threads_option(opts, out) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
93 94 95 96 97 98 99 |
# File 'lib/aws/active_job/sqs/cli_options.rb', line 93 def self.threads_option(opts, out) doc = 'The maximum number of worker threads to create. ' \ 'Defaults to 2x the number of processors available on this system.' opts.on('-t', '--threads INTEGER', Integer, doc) do |a| out[:threads] = a end end |
.visibility_timeout_option(opts, out) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/aws/active_job/sqs/cli_options.rb', line 63 def self.visibility_timeout_option(opts, out) doc = 'The visibility timeout is the number of seconds that a ' \ 'message will not be processable by any other consumers. ' \ 'You should set this value to be longer than your expected ' \ 'job runtime to prevent other processes from picking up an ' \ 'running job. See the SQS Visibility Timeout Documentation ' \ 'at https://docs.aws.amazon.com/AWSSimpleQueueService/latest/' \ 'SQSDeveloperGuide/sqs-visibility-timeout.html.' opts.on('-v', '--visibility_timeout INTEGER', Integer, doc) do |a| out[:visibility_timeout] = a end end |