Module: Sidekiq::Ichnite

Defined in:
lib/ichnite/sidekiq/middleware.rb

Defined Under Namespace

Classes: ClientMiddleware, ServerMiddleware

Class Method Summary collapse

Class Method Details

.aj_job_args(args) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ichnite/sidekiq/middleware.rb', line 20

def self.aj_job_args(args)
  first_arg = args.first

  # check if the first argument looks like a AJ metadata hash
  if first_arg.is_a?(Hash) && first_arg.key?('arguments')
    first_arg['arguments'].map do |arg|
      if arg.is_a?(Hash) && arg.key?('_aj_globalid')
        arg['_aj_globalid']
      else
        arg
      end
    end
  end
end

.aj_job_class(msg) ⇒ Object



11
12
13
# File 'lib/ichnite/sidekiq/middleware.rb', line 11

def self.aj_job_class(msg)
  msg['wrapped']
end

.job_args(msg) ⇒ Object



15
16
17
18
# File 'lib/ichnite/sidekiq/middleware.rb', line 15

def self.job_args(msg)
  args = msg['args']
  aj_job_args(args) || args
end

.job_class(msg) ⇒ Object



7
8
9
# File 'lib/ichnite/sidekiq/middleware.rb', line 7

def self.job_class(msg)
  aj_job_class(msg) || msg['class']
end

.job_id(msg) ⇒ Object



3
4
5
# File 'lib/ichnite/sidekiq/middleware.rb', line 3

def self.job_id(msg)
  msg['jid']
end