Skip to main content

Middleware

Layers wrap handlers and publishes: app-wide, per router or per registration.

A layer wraps a handler: it runs code of its own around each delivery, with the delivery's context. A publish layer wraps a publish: it runs around each message a handler sends. Both are static: the chain is one type built when the code compiles, and a layer costs only its own code. A chain chosen when the app starts, from configuration, goes into a dynamic stack, which boxes each step.