TCP Events Doc Polishing

This commit is contained in:
Gary Russell
2023-08-03 10:58:51 -04:00
committed by GitHub
parent 7dcc0bb125
commit 27e71abeca

View File

@@ -723,7 +723,8 @@ The following example shows how to configure a connection interceptor factory ch
=== TCP Connection Events
Beginning with version 3.0, changes to `TcpConnection` instances are reported by `TcpConnectionEvent` instances.
`TcpConnectionEvent` is a subclass of `ApplicationEvent` and can thus be received by any `ApplicationListener` defined in the `ApplicationContext` -- for example <<./event.adoc#appevent-inbound,an event inbound channel adapter>>.
`TcpConnectionEvent` is a subclass of `ApplicationEvent` and can thus be received by any `ApplicationListener` defined in the `ApplicationContext`, or an `@EventListener` method.
Also see <<./event.adoc#appevent-inbound,an event inbound channel adapter>>.
`TcpConnectionEvents` have the following properties:
@@ -733,9 +734,15 @@ Beginning with version 3.0, changes to `TcpConnection` instances are reported by
* `source`: The `TcpConnection`.
You can use this, for example, to determine the remote IP Address with `getHostAddress()` (cast required).
Available `TcpConnectionEvent` s, related to a specific connection include:
* `TcpConnectionOpenEvent`
* `TcpConnectionCloseEvent`
* `TcpConnectionExceptionEvent`
In addition, since version 4.0, the standard deserializers discussed in <<tcp-connection-factories>> now emit `TcpDeserializationExceptionEvent` instances when they encounter problems while decoding the data stream.
These events contain the exception, the buffer that was in the process of being built, and an offset into the buffer (if available) at the point where the exception occurred.
Applications can use a normal `ApplicationListener` or an `ApplicationEventListeningMessageProducer` (see <<./event.adoc#appevent-inbound,Receiving Spring Application Events>>) to capture these events, allowing analysis of the problem.
Applications can use a normal `ApplicationListener`, an `@EventListener` method, or an `ApplicationEventListeningMessageProducer` (see <<./event.adoc#appevent-inbound,Receiving Spring Application Events>>) to capture these events, allowing analysis of the problem.
Starting with versions 4.0.7 and 4.1.3, `TcpConnectionServerExceptionEvent` instances are published whenever an unexpected exception occurs on a server socket (such as a `BindException` when the server socket is in use).
These events have a reference to the connection factory and the cause.
@@ -753,6 +760,8 @@ IMPORTANT: To avoid delaying the listening thread from accepting connections, th
Starting with version 4.3.2, a `TcpConnectionFailedEvent` is emitted whenever a client connection cannot be created.
The source of the event is the connection factory, which you can use to determine the host and port to which the connection could not be established.
To use a single `ApplicationListener` (or `@EventListener` method) to receive all of these events (including `TcpConnectionEvent` s), configure the listener to receive `IpIntegrationEvent` s.
[[tcp-adapters]]
=== TCP Adapters