Class: Aws::ActiveJob::SQS::Configuration
- Inherits:
-
Object
- Object
- Aws::ActiveJob::SQS::Configuration
- Defined in:
- lib/aws/active_job/sqs/configuration.rb
Overview
Use Aws::ActiveJob::SQS.config
to access the singleton config instance.
Constant Summary collapse
- DEFAULTS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Default configuration options
{ max_messages: 10, shutdown_timeout: 15, retry_standard_errors: true, # TODO: Remove in next MV queues: {}, logger: ::Rails.logger, message_group_id: 'SqsActiveJobGroup', excluded_deduplication_keys: ['job_id'] }.freeze
Instance Attribute Summary collapse
- #async_queue_error_handler ⇒ Object private
- #client ⇒ Object private
-
#excluded_deduplication_keys ⇒ Object
Returns the value of attribute excluded_deduplication_keys.
- #logger ⇒ Object private
- #max_messages ⇒ Object private
- #message_group_id ⇒ Object private
- #queues ⇒ Object private
- #shutdown_timeout ⇒ Object private
- #visibility_timeout ⇒ Object private
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Configuration
constructor
Don’t use this method directly: Configuration is a singleton class, use
Aws::ActiveJob::SQS.config
to access the singleton config. -
#queue_url_for(job_queue) ⇒ Object
Return the queue_url for a given job_queue name.
- #to_h ⇒ Object private
- #to_s ⇒ Object private
Constructor Details
#initialize(options = {}) ⇒ Configuration
Don’t use this method directly: Configuration is a singleton class, use Aws::ActiveJob::SQS.config
to access the singleton config.
@ option options [Boolean] :retry_standard_errors
If `true`, StandardErrors raised by ActiveJobs are left on the queue
and will be retried (pending the SQS Queue's redrive/DLQ/maximum receive settings).
This behavior overrides the standard Rails ActiveJob
[Retry/Discard for failed jobs](https://guides.rubyonrails.org/active_job_basics.html#retrying-or-discarding-failed-jobs)
behavior. When set to `true` the retries provided by this will be
on top of any retries configured on the job with `retry_on`.
When `false`, retry behavior is fully configured
through `retry_on`/`discard_on` on the ActiveJobs.
88 89 90 91 92 93 94 |
# File 'lib/aws/active_job/sqs/configuration.rb', line 88 def initialize( = {}) [:config_file] ||= config_file if File.exist?(config_file) = DEFAULTS .merge(()) .merge() set_attributes() end |
Instance Attribute Details
#async_queue_error_handler ⇒ 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.
21 22 23 |
# File 'lib/aws/active_job/sqs/configuration.rb', line 21 def async_queue_error_handler @async_queue_error_handler end |
#client ⇒ 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.
21 22 23 |
# File 'lib/aws/active_job/sqs/configuration.rb', line 21 def client @client end |
#excluded_deduplication_keys ⇒ Object
Returns the value of attribute excluded_deduplication_keys.
25 26 27 |
# File 'lib/aws/active_job/sqs/configuration.rb', line 25 def excluded_deduplication_keys @excluded_deduplication_keys end |
#logger ⇒ 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.
21 22 23 |
# File 'lib/aws/active_job/sqs/configuration.rb', line 21 def logger @logger end |
#max_messages ⇒ 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.
21 22 23 |
# File 'lib/aws/active_job/sqs/configuration.rb', line 21 def @max_messages end |
#message_group_id ⇒ 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.
21 22 23 |
# File 'lib/aws/active_job/sqs/configuration.rb', line 21 def @message_group_id end |
#queues ⇒ 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.
21 22 23 |
# File 'lib/aws/active_job/sqs/configuration.rb', line 21 def queues @queues end |
#shutdown_timeout ⇒ 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.
21 22 23 |
# File 'lib/aws/active_job/sqs/configuration.rb', line 21 def shutdown_timeout @shutdown_timeout end |
#visibility_timeout ⇒ 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.
21 22 23 |
# File 'lib/aws/active_job/sqs/configuration.rb', line 21 def visibility_timeout @visibility_timeout end |
Instance Method Details
#queue_url_for(job_queue) ⇒ Object
Return the queue_url for a given job_queue name
109 110 111 112 113 114 |
# File 'lib/aws/active_job/sqs/configuration.rb', line 109 def queue_url_for(job_queue) job_queue = job_queue.to_sym raise ArgumentError, "No queue defined for #{job_queue}" unless queues.key? job_queue queues[job_queue] end |
#to_h ⇒ 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.
122 123 124 125 126 127 128 129 130 |
# File 'lib/aws/active_job/sqs/configuration.rb', line 122 def to_h h = {} instance_variables.each do |v| v_sym = v.to_s.delete('@').to_sym val = instance_variable_get(v) h[v_sym] = val end h end |
#to_s ⇒ 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.
117 118 119 |
# File 'lib/aws/active_job/sqs/configuration.rb', line 117 def to_s to_h.to_s end |