Closed spring-operator closed 10 years ago
Mark Fisher commented
A couple comments:
The JMS API actually defines javax.jms.ExceptionListener, and the javax.jms.Connection provides a setExceptionListener method. That's why that functionality exists in Spring's CachingConnectionFactory. There is no direct correlation in the AMQP/Rabbit APIs. Perhaps the closest thing is our own ConnectionListener callback interface which you can set on the Spring AMQP CachingConnectionFactory.
In Spring Integration we do not support error-handlers or error-channels on outbound adapters. The general idea is that error handling is configurable at the "entry point" (similar to the use of exception mappings in web.xml for a webapp) where all downstream Exceptions will propagate... like a big catch block for the whole message flow. You can add an error-channel on a 'gateway' proxy that exists mid-stream. Otherwise, we recommend handling errors at your inbound adapters. Hopefully that makes sense.
Gary Russell commented
As Mark said, there is no equivalent of the JmsExceptionListener in Rabbit.
However, you can register a ConnectionListener
which is informed of opens and closes. However, with the current release, close is only called on an explicit destroy of the connection factory. #1878 added support for calling the close method whenever a closed connection is detected.
Edwin Stang opened AMQP-211 and commented
In Spring-JMS it is possible to set a ExceptionListener for all connections:
In Spring-AMQP it is only possible to set ErrorHandlers for specific inbound components:
It would be nice to be able to set an ErrorHandler globally on the ConnectionFactory like this:
Also, currently I see no way to add an ErrorHandler on outbound Gateways or ChannelAdapters. This is a problem for me, because I cannot get Exceptions to be logged properly if they occur in an OutboundGateway. I need to be able to get Exceptions that occur in temporary response channels that wait for synchronous responses. In JMS I sometimes get timeout exceptions about the response not arriving within 5 seconds, but in AMQP nothing gets logged, thus I don't know what happens.
Affects: 1.0.0 GA