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

Reply via email to