module EXEL::Middleware
Middleware
is code configured to run around each processor execution. Custom middleware can be added as follows:
EXEL.configure do |config| config.middleware.add(MyMiddleware) config.middleware.add(AnotherMiddleware, 'constructor arg') end
Middleware
can be any class that implements a call
method that includes a call to yield
:
class MyMiddleware def call(processor, context, args) puts 'before process' yield puts 'after process' end end
The call
method will be passed the class of the processor that will be executed, the current context, and any args that were passed to the processor in the job definition.