Interface FlightServerMiddleware
- All Known Implementing Classes:
ServerCallHeaderAuthMiddleware,ServerHeaderMiddleware,ServerSessionMiddleware
Middleware are instantiated per-call.
Methods are not guaranteed to be called on any particular thread, relative to the thread that
Flight requests are executed on. Do not depend on thread-local storage; instead, use state on the
middleware instance. Service implementations may communicate with middleware implementations
through FlightProducer.CallContext.getMiddleware(Key). Methods on
the middleware instance are non-reentrant, that is, a particular RPC will not make multiple
concurrent calls to methods on a single middleware instance. However, methods on the factory
instance are expected to be thread-safe, and if the factory instance returns the same middleware
object more than once, then that middleware object must be thread-safe.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA factory for Flight server middleware.static classA key for Flight server middleware. -
Method Summary
Modifier and TypeMethodDescriptionvoidonBeforeSendingHeaders(CallHeaders outgoingHeaders) Callback for when the underlying transport is about to send response headers.voidonCallCompleted(CallStatus status) Callback for when the underlying transport has completed a call.voidonCallErrored(Throwable err) Callback for when an RPC method implementation throws an uncaught exception.
-
Method Details
-
onBeforeSendingHeaders
Callback for when the underlying transport is about to send response headers.- Parameters:
outgoingHeaders- A mutable set of response headers. These can be manipulated to send different headers to the client.
-
onCallCompleted
Callback for when the underlying transport has completed a call.- Parameters:
status- Whether the call completed successfully or not.
-
onCallErrored
Callback for when an RPC method implementation throws an uncaught exception.May be called multiple times, and may be called before or after
onCallCompleted(CallStatus). Generally, an uncaught exception will end the call with a errorCallStatus, and will be reported toonCallCompleted(CallStatus), but not necessarily this method.- Parameters:
err- The exception that was thrown.
-