In spring integration I have a simple tcp client pipe: a gateway, a tcp outbound gateway a service activator plus an error channel. In the tcp-connection-factory there is a simp
Actually
send to the channel
a Message
with TcpConnectionExceptionEvent
(in your case) as payload
.
Therefore your subscriber (your TcpErrorHandler
) can accepts TcpConnectionExceptionEvent
as a method argument.
In that method you can do further logic, e.g. extract the original Exception
from that IntegrationEvent
.
There are several places in the IP
module when TcpConnectionSupport.publishConnectionExceptionEvent
is used.
If you say that you don't catch time out exception
, it will great if you share the logs on the matter. I wonder which place we don't try...catch
on the SocketTimeoutException
...
UPDATE
public class TcpErrorHandler {
public void onException(TcpConnectionExceptionEvent event) {
System.out.println("Exception!!! ");
event.getCause();
....
}
}
This should work.
UPDATE2
According to your code:
try {
super.send(message);
}
catch (Exception e) {
System.out.println("catched_send_exception");
}
Don't you think that it is bad to suffocate an Exception there?
From other side: would you mind switching on DEBUG
logging level for the org.springframework.integration
category and share here the logs, when you are sure that your tcpErrorHandler
should be invoked?
From other side try
without event-types
at all. I mean let's see, if it handle any IpIntegrationEvent
.