Module: Subserver::Middleware
- Defined in:
- lib/subserver/middleware/chain.rb,
lib/subserver/middleware/active_record.rb
Overview
Middleware is code configured to run before/after a message is processed. It is patterned after Rack middleware.
To modify middleware for the server, just call with another block:
Subserver.configure do |config|
config.middleware do |chain|
chain.add MyServerHook
chain.remove ActiveRecord
end
end
To insert immediately preceding another entry:
Subserver.configure do |config|
config.middleware do |chain|
chain.insert_before ActiveRecord, MyServerHook
end
end
To insert immediately after another entry:
Subserver.configure do |config|
config.middleware do |chain|
chain.insert_after ActiveRecord, MyServerHook
end
end
This is an example of a minimal server middleware:
class MyServerHook
def call(subscriber_class, )
puts "Before work"
yield
puts "After work"
end
end
Defined Under Namespace
Classes: ActiveRecord, Chain, Entry