Error handling: how to access the message that thrown the exception
Hallo all.
I configured my gateway with a custom error channel.
<int:gateway id="onlineMessageGateway" service-interface="it.alten.intesasanpaolo.contratto.onlin e.gateway.OnlineMessageGateway" default-request-channel="onlineMessagePreProcessingChannel" error-channel="errorHandler"/>
Now when in one of my chains is raised an exception the service activator subscribed on the errorHandler channel is executed:
Code:
public void activate(Message<?> message) {
logger.debug("Calling error handler activator");
logger.debug("Message {}", message);
Object payload = message.getPayload();
logger.debug("Payload {}", payload);
}
And this is the log:
Code:
2011-05-25 18:26:35,921 DEBUG 01025649900982072 - 009 - 1343 [ReimpiantoContrattoActivator] Calling error handler activator
2011-05-25 18:26:35,921 DEBUG 01025649900982072 - 009 - 1343 [ReimpiantoContrattoActivator] Message [Payload=org.springframework.integration.MessageHandlingException: java.lang.NullPointerException][Headers={timestamp=1306340795828, id=23f207df-7e90-44e5-a903-ee558956589d}]
2011-05-25 18:26:35,921 DEBUG 01025649900982072 - 009 - 1343 [ReimpiantoContrattoActivator] Payload org.springframework.integration.MessageHandlingException: java.lang.NullPointerException
Is it possible to access the message payload that thrown the exception?
Kind regards
Massimo