使用日誌我定義一個錯誤處理程序,它適用於多條路線,即駱駝:如何在的ErrorHandler
errorHandler(transactionErrorHandler()
.maximumRedeliveries(5)
.log("SOMETHING USELESS");
from(file1)
.id(route1)
.transacted()
.process(new SpecificProcessor1());
from(file2)
.id(route2)
.transacted()
.process(new SpecificProcessor2());
當異常內部的SpecificProcessor類之一發生時,以下記錄:
[10-Jan-2014 15:08:59.449] [Error] SOMETHING USELESS: Failed delivery for (MessageId: ID-BLAH BLAH). On delivery attempt: 1 caught: java.lang.Exception: cannot do whatever I'm supposed to do
現在我想打印有用的東西,以幫助識別異常是否已經發生ROUTE1或路徑2即:
[10-Jan-2014 15:08:59.449] [Error] ROUTE 1: Failed delivery for (MessageId: ID-BLAH BLAH). On delivery attempt: 1 caught: java.lang.Exception: cannot do whatever I'm supposed to do
我該如何做到這一點?
我嘗試過類似.log($ {routeId})的東西,但它不起作用。
非常感謝!