scala - Global onException to handle multiple RouteBuilder classes -
scala - Global onException to handle multiple RouteBuilder classes -
i need create onexception, global on whole route builders have in order not rewrite same line every route builder create . current scope exception handler camel context specific route builder . need create route builder classes ,r1 , r2, utilize same onexception().process.
the current working onexception utilize :
def configure { onexception(classof[customexception]).process(exceptionprocessor). process(doextraprocess) from(address). process(dosmth). process(dosmthelse) }
when have moved onexception() line configre method on class level next :
onexception(classof[customexception]).process(exceptionprocessor). process(doextraprocess) def configure { from(address). process(dosmth). process(dosmthelse) }
i got error :
caused by: org.apache.camel.failedtocreaterouteexception: failed create route route52 at: >>> onexception[[class customexception] -> [process[null], process[null]]] <<< in route: route[[from[direct:locus]] -> [onexception[[... because of ref must specified on: process[null]
caused by: java.lang.illegalargumentexception: ref must specified on: process[null]
first, onexception() needs called configure() method. next, can utilize inheritance reuse exception handling. create parent routebuilder class , set mutual exception handling in method. have each subclass phone call mutual method in configure() method...
scala spring-mvc apache-camel
Comments
Post a Comment