You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/reference/asciidoc/ip.adoc
+11-2
Original file line number
Diff line number
Diff line change
@@ -723,7 +723,8 @@ The following example shows how to configure a connection interceptor factory ch
723
723
=== TCP Connection Events
724
724
725
725
Beginning with version 3.0, changes to `TcpConnection` instances are reported by `TcpConnectionEvent` instances.
726
-
`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>>.
726
+
`TcpConnectionEvent` is a subclass of `ApplicationEvent` and can thus be received by any `ApplicationListener` defined in the `ApplicationContext`, or an `@EventListener` method.
727
+
Also see <<./event.adoc#appevent-inbound,an event inbound channel adapter>>.
727
728
728
729
`TcpConnectionEvents` have the following properties:
729
730
@@ -733,9 +734,15 @@ Beginning with version 3.0, changes to `TcpConnection` instances are reported by
733
734
* `source`: The `TcpConnection`.
734
735
You can use this, for example, to determine the remote IP Address with `getHostAddress()` (cast required).
735
736
737
+
Available `TcpConnectionEvent` s, related to a specific connection include:
738
+
739
+
* `TcpConnectionOpenEvent`
740
+
* `TcpConnectionCloseEvent`
741
+
* `TcpConnectionExceptionEvent`
742
+
736
743
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.
737
744
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.
738
-
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.
745
+
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.
739
746
740
747
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).
741
748
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
753
760
Starting with version 4.3.2, a `TcpConnectionFailedEvent` is emitted whenever a client connection cannot be created.
754
761
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.
755
762
763
+
To use a single `ApplicationListener` (or `@EventListener` method) to receive all of these events (including `TcpConnectionEvent` s), configure the listener to receive `IpIntegrationEvent` s.
0 commit comments