Package reactor.netty
Interface ConnectionObserver
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Event listeners for connection lifecycle.
A normal event cycle is as follows :
- onUncaughtException
- onStateChange
- Since:
- 0.8
- Author:
- Stephane Maldini
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
A marker interface for various state signals used inonStateChange(Connection, State)
-
Method Summary
Modifier and TypeMethodDescriptiondefault Context
Connection listenerContext
.static ConnectionObserver
Return a noop connection listener.void
onStateChange
(Connection connection, ConnectionObserver.State newState) React on connection state change (e.g.default void
onUncaughtException
(Connection connection, Throwable error) React on connection fatal error, will request a disconnecting state change by default.default ConnectionObserver
then
(ConnectionObserver other) Chain together anotherConnectionObserver
.
-
Method Details
-
emptyListener
Return a noop connection listener.- Returns:
- a noop connection listener
-
currentContext
Connection listenerContext
.- Returns:
- current
Context
orContext.empty()
-
onUncaughtException
React on connection fatal error, will request a disconnecting state change by default. It should only catch exceptions that can't be consumed by aNettyInbound.receive()
subscriber.- Parameters:
connection
- the remote connectionerror
- the failing cause
-
onStateChange
React on connection state change (e.g. http request or response).- Parameters:
connection
- the connection referencenewState
- the new State
-
then
Chain together anotherConnectionObserver
.- Parameters:
other
- the nextConnectionObserver
- Returns:
- a new composite
ConnectionObserver
-