2014-01-05 57 views
0

我想在我的代碼中處理異常。但是,消息傳遞異常包裝了由代碼拋出的自定義異常。如何在Spring集成中的異常路由器中使用根本原因異常類型

現在我想使用異常路由器,如果類型是我的自定義異常,那麼我想發送消息到隊列a,否則隊列b。

現在的問題是,路由器正在接收消息傳遞異常對象,因此它無法識別我的異常,並將消息發送到隊列b,而異常根本原因仍然是我的自定義異常。

<int:exception-type-router input-channel="exceptionRouterChannel" 
    default-output-channel="unpersistedDest"> 
    <int:mapping exception-type= 
        "org.springframework.integration.MessageRejectedException" 
     channel="validationErrorsDest" /> 
    <int:mapping exception-type= 
         "com.error.StaleMessageException" 
     channel="discardDest" /> 
</int:exception-type-router>  

任何人都可以在這方面的幫助:

路由器下面給出。

回答