Class: ActiveJob::QueueAdapters::SqsAdapter::Params Private

Inherits:
Object
  • Object
show all
Defined in:
lib/active_job/queue_adapters/sqs_adapter/params.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Build request parameter of Aws::SQS::Client

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(job, body) ⇒ Params

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.

Returns a new instance of Params.



19
20
21
22
# File 'lib/active_job/queue_adapters/sqs_adapter/params.rb', line 19

def initialize(job, body)
  @job = job
  @body = body || job.serialize
end

Class Method Details

.assured_delay_seconds(timestamp) ⇒ 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.

Raises:

  • (ArgumentError)


10
11
12
13
14
15
16
# File 'lib/active_job/queue_adapters/sqs_adapter/params.rb', line 10

def assured_delay_seconds(timestamp)
  delay = (timestamp - Time.now.to_f).floor
  delay = 0 if delay.negative?
  raise ArgumentError, 'Unable to queue a job with a delay great than 15 minutes' if delay > 15.minutes

  delay
end

Instance Method Details

#entryObject

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.



28
29
30
31
32
33
34
# File 'lib/active_job/queue_adapters/sqs_adapter/params.rb', line 28

def entry
  if Aws::ActiveJob::SQS.fifo?(queue_url)
    default_entry.merge(options_for_fifo)
  else
    default_entry
  end
end

#queue_urlObject

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.



24
25
26
# File 'lib/active_job/queue_adapters/sqs_adapter/params.rb', line 24

def queue_url
  @queue_url ||= Aws::ActiveJob::SQS.config.queue_url_for(@job.queue_name)
end