Hi Claus, Compilation was successful, but during junit execution it is now throwing errors. So if I summaries it then I was trying to execute below code.
from(customString) .errorHandler(new RetrieveCustomErrorHandler()) .convertBodyTo(CustomRetrieve.class) .setProperty(JAXWS_METHOD_NAME_PROPERTY, constant("Retrieve")) .to("direct:customEntryPoint") .routeId(Routes.CUSTOM_RETRIEVE.getRouteId()); final class RetrieveCustomErrorHandler implements ErrorHandlerFactory{ @Override public boolean supportTransacted() { return false; } @Override public ErrorHandlerFactory cloneBuilder() { ErrorHandlerFactory handler = new RetrieveCustomErrorHandler(); processCustomData(); return handler; } private Processor processCustomData(){ return new DelegateAsyncProcessor(processor) { @Override public boolean process(final Exchange exchange, final AsyncCallback callback) { return super.process(exchange, new AsyncCallback() { @Override public void done(boolean doneSync) { exchange.removeProperty(Exchange.REDELIVERY_EXHAUSTED); callback.done(doneSync); if (exchange.getException() != null) { LOGGER.info("End retrieving custom data : [" .concat(exchange.getProperty(ExchangeProperties.CUSTOM_DATA, String.class)) .concat("] - result : NO: ").concat(exchange.getException().getMessage())); } } }); } } } Now it is throwing below error Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'retrieveCustomRouteBuilder': Invocation of init method failed Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route customRetrieveRouteCustom at: >>> ConvertBodyTo[com.sample.webservices.custom.retrieve.CustomRetrieve] <<< in route: Route(customRetrieveRouteCustom)[From[direct:test... because of Unsupported definition: com.sample.service.quality.camel.routes.RetrieveCustomErrorHandler@29d2904b Caused by: java.lang.IllegalStateException: Unsupported definition: com.sample.service.quality.camel.routes.RetrieveCustomErrorHandler@29d2904b Please suggest what is wrong here, so that I can try the same. Regards Kushagra On Fri, Aug 11, 2023 at 6:17 PM Kushagra Bindal <bindal.kusha...@gmail.com> wrote: > > Was able to resolve this, thanks for your input. > > On Thu, Aug 10, 2023 at 5:11 PM Kushagra Bindal > <bindal.kusha...@gmail.com> wrote: > > > > Do you have any handy sample with you which I can refer to for this case? > > > > On Thu, Aug 10, 2023 at 2:34 PM Claus Ibsen <claus.ib...@gmail.com> wrote: > > > > > > Hi > > > > > > Read the javadoc of those methods what they do and just implement what you > > > need - its in the name also - supportsTransaction etc. > > > > > > On Thu, Aug 10, 2023 at 10:29 AM Kushagra Bindal > > > <bindal.kusha...@gmail.com> > > > wrote: > > > > > > > Earlier the usage was to be like that as I mentioned here... We > > > > usually checked on AsyncCallback and reacted accordingly. > > > > > > > > > > > > @Override > > > > public Processor createErrorHandler(RouteContext routeContext, > > > > Processor processor) { > > > > return new DelegateAsyncProcessor(processor) { > > > > @Override > > > > public boolean process(final Exchange exchange, final > > > > AsyncCallback callback) { > > > > return super.process(exchange, new AsyncCallback() { > > > > @Override > > > > public void done(boolean doneSync) { > > > > > > > > exchange.removeProperty(Exchange.REDELIVERY_EXHAUSTED); > > > > callback.done(doneSync); > > > > if (exchange.getException() != null) { > > > > LOGGER.info("End retrieving custom data : [" > > > > > > > > .concat(exchange.getProperty(ExchangeProperties.CUSTOM_DATA, > > > > String.class)) > > > > .concat("] - result : NO: > > > > ").concat(exchange.getException().getMessage())); > > > > } > > > > } > > > > }); > > > > } > > > > > > > > Please suggest if there is some alternative way of achieving the same. > > > > > > > > On Thu, Aug 10, 2023 at 1:44 PM Claus Ibsen <claus.ib...@gmail.com> > > > > wrote: > > > > > > > > > > Why are you creating your own error handler implementation at all? > > > > > What > > > > is > > > > > special about it > > > > > > > > > > On Thu, Aug 10, 2023 at 10:05 AM Kushagra Bindal < > > > > bindal.kusha...@gmail.com> > > > > > wrote: > > > > > > > > > > > Hi, > > > > > > > > > > > > I am trying to upgrade my camel version from 2.25.4 to 4.0.0.M3. > > > > > > > > > > > > Earlier I use to set ErrorHandler using below pattern. > > > > > > > > > > > > from(customString) > > > > > > .errorHandler(new RetrieveCustomErrorHandler()) > > > > > > .convertBodyTo(CustomRetrieve.class) > > > > > > .setProperty(JAXWS_METHOD_NAME_PROPERTY, constant("Retrieve")) > > > > > > .to("direct:customEntryPoint") > > > > > > .routeId(Routes.CUSTOM_RETRIEVE.getRouteId()); > > > > > > > > > > > > Earlier I used to implements ErrorHandlerFactory for > > > > > > RetrieveCustomErrorHandler and use to override createErrorHandler() > > > > > > method to return Processor Object. > > > > > > > > > > > > Now with the latest version of Camel, I just wanted to understand > > > > > > the > > > > > > new mechanism of doing the same. > > > > > > With the new ErrorHandlerFactory interface I am getting new methods > > > > named > > > > > > as > > > > > > > > > > > > public ErrorHandlerFactory cloneBuilder() > > > > > > > > > > > > public boolean supportTransacted() > > > > > > > > > > > > Any suggestions/help will be appreciated. > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > Regards, > > > > > > Kushagra > > > > > > > > > > > > > > > > > > > > > -- > > > > > Claus Ibsen > > > > > ----------------- > > > > > @davsclaus > > > > > Camel in Action 2: https://www.manning.com/ibsen2 > > > > > > > > > > > > > > > > -- > > > > Regards, > > > > Kushagra > > > > > > > > > > > > > -- > > > Claus Ibsen > > > ----------------- > > > @davsclaus > > > Camel in Action 2: https://www.manning.com/ibsen2 > > > > > > > > -- > > Regards, > > Kushagra > > > > -- > Regards, > Kushagra -- Regards, Kushagra