Class: Aws::Rails::SqsActiveJob::Configuration
- Inherits:
-
Object
- Object
- Aws::Rails::SqsActiveJob::Configuration
- Defined in:
- lib/aws/rails/sqs_active_job/configuration.rb
Overview
Configuration for AWS SQS ActiveJob. Use Aws::Rails::SqsActiveJob.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, queues: {}, logger: ::Rails.logger, message_group_id: 'SqsActiveJobGroup' }
Instance Attribute Summary collapse
- #async_queue_error_handler ⇒ Object private
- #client ⇒ Object private
- #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: Confugration is a singleton class, use
Aws::Rails::SqsActiveJob.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: Confugration is a singleton class, use Aws::Rails::SqsActiveJob.config
to access the singleton config.
86 87 88 89 90 91 92 |
# File 'lib/aws/rails/sqs_active_job/configuration.rb', line 86 def initialize( = {}) [:config_file] ||= config_file if config_file.exist? = 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.
36 37 38 |
# File 'lib/aws/rails/sqs_active_job/configuration.rb', line 36 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.
36 37 38 |
# File 'lib/aws/rails/sqs_active_job/configuration.rb', line 36 def client @client 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.
36 37 38 |
# File 'lib/aws/rails/sqs_active_job/configuration.rb', line 36 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.
36 37 38 |
# File 'lib/aws/rails/sqs_active_job/configuration.rb', line 36 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.
36 37 38 |
# File 'lib/aws/rails/sqs_active_job/configuration.rb', line 36 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.
36 37 38 |
# File 'lib/aws/rails/sqs_active_job/configuration.rb', line 36 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.
36 37 38 |
# File 'lib/aws/rails/sqs_active_job/configuration.rb', line 36 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.
36 37 38 |
# File 'lib/aws/rails/sqs_active_job/configuration.rb', line 36 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
99 100 101 102 103 104 |
# File 'lib/aws/rails/sqs_active_job/configuration.rb', line 99 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.
112 113 114 115 116 117 118 119 120 |
# File 'lib/aws/rails/sqs_active_job/configuration.rb', line 112 def to_h h = {} self.instance_variables.each do |v| v_sym = v.to_s.gsub('@', '').to_sym val = self.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.
107 108 109 |
# File 'lib/aws/rails/sqs_active_job/configuration.rb', line 107 def to_s to_h.to_s end |