Class: GovukSidekiq::APIHeaders::ClientMiddleware
- Inherits:
-
Object
- Object
- GovukSidekiq::APIHeaders::ClientMiddleware
- Defined in:
- lib/govuk_sidekiq/api_headers.rb
Overview
Client-side middleware runs before the pushing of the job to Redis and allows you to modify/stop the job before it gets pushed.
github.com/mperham/sidekiq/wiki/Middleware#client-side-middleware
Instance Method Summary collapse
Instance Method Details
#call(worker_class, job, queue, redis_pool) ⇒ Object
10 11 12 13 |
# File 'lib/govuk_sidekiq/api_headers.rb', line 10 def call(worker_class, job, queue, redis_pool) job["args"] << header_arguments yield end |
#header_arguments ⇒ Object
15 16 17 18 19 20 |
# File 'lib/govuk_sidekiq/api_headers.rb', line 15 def header_arguments { authenticated_user: GdsApi::GovukHeaders.headers[:x_govuk_authenticated_user], request_id: GdsApi::GovukHeaders.headers[:govuk_request_id], } end |