Spring integration 使用注释的异常路由器
我试图将我的代码转换成java注释,但我一直坚持使用java注释Spring integration 使用注释的异常路由器,spring-integration,Spring Integration,我试图将我的代码转换成java注释,但我一直坚持使用java注释 <int:exception-type-router input-channel="failed-email-fetch" default-output-channel="errorChannel"> <int:mapping exception-type="com.XXXXXX.RateException" channel="customError" /> </int:except
<int:exception-type-router input-channel="failed-email-fetch" default-output-channel="errorChannel">
<int:mapping exception-type="com.XXXXXX.RateException" channel="customError" />
</int:exception-type-router>
我最后使用了下面的方法,不确定这是否是最好的方法
@Router(inputChannel = "failedEmailFetch",defaultOutputChannel = "errorChannel")
public String handleError(Message<AggregateMessageDeliveryException> message) {
log.info("{}",message.getPayload().getCause().getCause());
if( message.getPayload().getRootCause() instanceof MessageException)
return "customError";
else
return "errorChannel";
}
@路由器(inputChannel=“failedEmailFetch”,defaultOutputChannel=“errorChannel”)
公共字符串句柄错误(消息){
log.info(“{}”,message.getPayload().getCause().getCause());
if(message.getPayload().getRootCause()实例MessageException)
返回“customError”;
其他的
返回“错误通道”;
}
我最后使用了下面的方法,不确定这是否是最好的方法
@Router(inputChannel = "failedEmailFetch",defaultOutputChannel = "errorChannel")
public String handleError(Message<AggregateMessageDeliveryException> message) {
log.info("{}",message.getPayload().getCause().getCause());
if( message.getPayload().getRootCause() instanceof MessageException)
return "customError";
else
return "errorChannel";
}
@路由器(inputChannel=“failedEmailFetch”,defaultOutputChannel=“errorChannel”)
公共字符串句柄错误(消息){
log.info(“{}”,message.getPayload().getCause().getCause());
if(message.getPayload().getRootCause()实例MessageException)
返回“customError”;
其他的
返回“错误通道”;
}
当@ServiceActivator
注释位于消息处理程序上时,您还需要@Bean
@ServiceActivator
单独用于POJO消息传递
看
消费端点有2个bean,处理程序和消费者;@ServiceActivator
定义使用者。@Bean
是处理程序。当@ServiceActivator
注释位于消息处理程序上时,您还需要@Bean
@ServiceActivator
单独用于POJO消息传递
看
消费端点有2个bean,处理程序和消费者;@ServiceActivator
定义使用者。@Bean
是处理者。谢谢gary,我错过了我将测试它并完美地检查它,但是我必须使用setChannelMapping而不是setChannelMapping谢谢gary,我错过了我将测试它并完美地检查它,但是我必须使用setChannelMapping而不是setChannelMapping