Module: Ekylibre::PluginSystem::Middleware::SidekiqMiddleware

Defined in:
lib/ekylibre/plugin_system/middleware/sidekiq_middleware/client_middleware.rb,
lib/ekylibre/plugin_system/middleware/sidekiq_middleware.rb,
lib/ekylibre/plugin_system/middleware/sidekiq_middleware/server_middleware.rb

Overview

Sidekiq server middleware adding the provided container to the job context. It also makes the container accessible through RequestStore for the legacy code to be able to access it globally.

Defined Under Namespace

Classes: ClientMiddleware, ServerMiddleware

Class Method Summary collapse

Class Method Details

.setup(container:) ⇒ Object

This method sets up sidekiq middlewares allowing to access the container natively inside jobs.

In addition, it also stores the job’s container inside RequestStore so that the legacy code of Ekylibre can globally access the container when needed.

The client middleware is called when a job is enqueued, the server middleware when the job is executed.



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ekylibre/plugin_system/middleware/sidekiq_middleware.rb', line 15

def setup(container:)
  ::Sidekiq.configure_client do |config|
    configure_client(config)
  end

  ::Sidekiq.configure_server do |config|
    configure_client(config)

    configure_server(config, container: container)
  end
end