Class: Sidekiq::EncryptedArgs::ClientMiddleware

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq/encrypted_args/client_middleware.rb

Overview

Sidekiq client middleware for encrypting arguments on jobs for workers with ‘encrypted_args` set in the `sidekiq_options`.

This middleware is responsible for encrypting job arguments before they are sent to Redis. It runs on the client side when jobs are enqueued.

See Also:

Instance Method Summary collapse

Instance Method Details

#call(worker_class, job, queue, redis_pool = nil) ⇒ Object

Encrypt specified arguments before they’re sent off to the queue



14
15
16
17
18
19
20
21
# File 'lib/sidekiq/encrypted_args/client_middleware.rb', line 14

def call(worker_class, job, queue, redis_pool = nil)
  if job.include?("encrypted_args")
    encrypted_args = EncryptedArgs.encrypted_args_option(worker_class, job)
    encrypt_job_arguments!(job, encrypted_args)
  end

  yield
end