From 27e71abeca507cbc5346de15c32dc13756fd0882 Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Thu, 3 Aug 2023 10:58:51 -0400 Subject: [PATCH] TCP Events Doc Polishing --- src/reference/asciidoc/ip.adoc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/reference/asciidoc/ip.adoc b/src/reference/asciidoc/ip.adoc index 4d1470cbae..252af58ee3 100644 --- a/src/reference/asciidoc/ip.adoc +++ b/src/reference/asciidoc/ip.adoc @@ -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 <> 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