Class: Shoryuken::ActiveJob::JobWrapper Private

Inherits:
Object
  • Object
show all
Includes:
Worker
Defined in:
lib/shoryuken/active_job/job_wrapper.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.

Internal worker class that processes ActiveJob jobs. This class bridges ActiveJob’s interface with Shoryuken’s worker interface.

Instance Method Summary collapse

Methods included from Worker

included

Instance Method Details

#perform(sqs_msg, hash) ⇒ 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.

Processes an ActiveJob job from an SQS message.

Parameters:

  • sqs_msg (Shoryuken::Message)

    The SQS message containing the job data

  • hash (Hash)

    The parsed job data from the message body



21
22
23
24
25
# File 'lib/shoryuken/active_job/job_wrapper.rb', line 21

def perform(sqs_msg, hash)
  receive_count = sqs_msg.attributes['ApproximateReceiveCount'].to_i
  past_receives = receive_count - 1
  ::ActiveJob::Base.execute hash.merge({ 'executions' => past_receives })
end