-
1. Re: Question about errorHandler for switchyard.xml
splatch Mar 28, 2013 4:45 AM (in response to hisao.furuichi)You may use CDI together with Camel route:
<route errorHandlerRef="errorHandlerRef"> <!-- ... --> </route>
public class Factory { @Produces @Named("errorHandlerRef") public ErrorHandlerBuilder createErrorHandler() { return new LoggingErrorHandlerBuilder(); } }
In Java DSL it's bit easier:
public class Builder extends RouteBuilder { @Override public void configure() { errorHandler(noErrorHandler()); from("...").to("..."); } }
-
2. Re: Question about errorHandler for switchyard.xml
hisao.furuichi Mar 28, 2013 4:52 AM (in response to splatch)Thanks for your advice. That's what I wanted to know!
-
3. Re: Question about errorHandler for switchyard.xml
hisao.furuichi May 9, 2013 1:56 AM (in response to splatch)I post a comment because I have a question relating with this thread.
At first, I could set error handler options using CDI. Here is what I got so far.
public class ErrorHandlerFactory {
@Produces
@Named("errorHandlerRef")
public ErrorHandlerBuilder createErrorHandler() {
return new DefaultErrorHandlerBuilder().maximumRedeliveries(5).backOffMultiplier(2).retryAttemptedLogLevel(LoggingLevel.WARN);
}
}
Now, I'm thinking whether I can set options using xml-based configuration like <errorHandler>. Any idea?
Thanks
-
4. Re: Question about errorHandler for switchyard.xml
splatch May 9, 2013 4:00 AM (in response to hisao.furuichi)Camel service implementations limits camel usage only to one route so far. You may use all elements inside route definition which are supported by camel. The errorHandler element is available only under camelContext element, so you can not use it inside <route>, however you may configure all necessary settings with ErrorHandlerBuilder. Camel design in this area is really flatten - DefaultErrorHandler supports redelivery and dead letter. LoggingErrorHandler supports redelivery as well (it's extension of DefaultErrorHandler).
Kind regards,
Lukasz
-
5. Re: Question about errorHandler for switchyard.xml
hisao.furuichi May 22, 2013 8:55 PM (in response to splatch)Thanks for your comment, and sorry for the late response.
Now I understand that we can't use errorHandler element inside <route>. I found a jira ticket[1] talking about supporting <routes>, so I'm thinking there is a possibility to support <errorHandler> by supporting <routes>. On the Jira, I added a comment for supporting <errorHandler>. If you have a time, please check it.
[1] Allow multiple route definitions per Camel service implementation
https://issues.jboss.org/browse/SWITCHYARD-1411#comment-12776193