| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Runtime.Server.Middleware
Description
The front door's cross-cutting middleware pieces and the control-plane health
endpoints. Those are the drain-aware going-away header and the /livez / /readyz probe
application. Ecluse.Runtime.Server's serverMiddleware composes the pieces around the proxy
Application. Its dispatch answers the probes through probeApplication. The request-body cap
is not here: it is a route concern, enforced at the read site by the only body-consuming route
(publish).
Synopsis
- goingAwayMiddleware :: DrainSignal -> Middleware
- probeApplication :: DrainSignal -> IO Readiness -> IO Liveness -> Application
- jsonResponse :: Status -> LByteString -> Response
Drain-aware going-away header
goingAwayMiddleware :: DrainSignal -> Middleware Source #
While the instance is draining, stamp Connection: close on every response. A keep-alive
client or a mesh connection pool then stops reusing the socket on a closing instance.
Control-plane health probes
probeApplication :: DrainSignal -> IO Readiness -> IO Liveness -> Application Source #
The control-plane health probes, answered above any mount: /livez from the injected
liveness check, /readyz from the drain signal and startup gate. Any other path is a 404.
Neutral response shapes
jsonResponse :: Status -> LByteString -> Response Source #
A JSON response with the given status and body, tagged application/json.