class Aws::Rails::SqsActiveJob::Configuration

Use Aws::Rails::SqsActiveJob.config to access the singleton config instance.
Configuration for AWS SQS ActiveJob.

def client

def client
  @client ||= Aws::SQS::Client.new(user_agent_suffix: user_agent)
end

def config_file

def config_file
  file = ::Rails.root.join("config/aws_sqs_active_job/#{::Rails.env}.yml")
  file = ::Rails.root.join('config/aws_sqs_active_job.yml') unless file.exist?
  file
end

def config_file_path(options)

Returns:
  • (String) - Configuration path found in environment or YAML file.
def config_file_path(options)
  options[:config_file] || ENV["AWS_SQS_ACTIVE_JOB_CONFIG_FILE"]
end

def file_options(options = {})

def file_options(options = {})
  file_path = config_file_path(options)
  if file_path
    load_from_file(file_path)
  else
    {}
  end
end

def initialize(options = {})

Options Hash: (**options)
  • :client (SQS::Client) -- SQS Client to use. A default
  • :async_queue_error_handler (Callable) -- An error handler
  • :message_group_id (String) --
  • :config_file (String) --
  • :logger (ActiveSupport::Logger) -- Logger to use
  • :shutdown_timeout (Integer) --
  • :visibility_timeout (Integer) --
  • :max_messages (Integer) --
  • :queues (Hash[Symbol, String]) -- A mapping between the

Parameters:
  • options (Hash) --
def initialize(options = {})
  options[:config_file] ||= config_file if config_file.exist?
  options = DEFAULTS
     .merge(file_options(options))
     .merge(options)
  set_attributes(options)
end

def load_from_file(file_path)

Load options from YAML file
def load_from_file(file_path)
  require "erb"
  opts = YAML.load(ERB.new(File.read(file_path)).result) || {}
  opts.deep_symbolize_keys
end

def queue_url_for(job_queue)

Return the queue_url for a given job_queue name
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.to_sym]
end

def set_attributes(options)

Set accessible attributes after merged options.
def set_attributes(options)
  options.keys.each do |opt_name|
    instance_variable_set("@#{opt_name}", options[opt_name])
  end
end

def to_h

Other tags:
    Api: - private
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

def to_s

Other tags:
    Api: - private
def to_s
  to_h.to_s
end

def user_agent

def user_agent
  "ft/aws-sdk-rails-activejob/#{Aws::Rails::VERSION}"
end