camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raul Kripalani <>
Subject Re: Best practice to parse JSON response and retry if error
Date Tue, 22 May 2012 10:00:14 GMT
Have you tried encapsulating both the HTTP invocation + the JSON
unmarshalling behind a direct: endpoint? i.e.

       .unmarshal().json(JsonLibrary.Jackson, ShellResponse.class);

The default error handler in this new route (DefaultErrorHandler) will
immediately return the exception to the caller.

>From the parent route, you invoke the direct endpoint using:
.to("direct:doHttpInvocation"). Hence, the two operations become one from
the viewpoint of the parent route, so it should now cycle over
"direct:doHttpInvocation" for redeliveries.

Let us know if that worked for you.


*Raúl Kripalani*
Principal Consultant | FuseSource Corp. | <>
skype: raul.fuse | twitter: @raulvk <>,


On 21 May 2012 22:13, Nestor Urquiza <> wrote:

> One way to solve this (successfully tested) would be using a bean
> encapsulating all the logic (http request, unmarshalling, testing for
> errors):
> <code>
> //So we are probably better just building a bean that invokes the http
> service, analyze the response and throws Exception if error
>        .setHeader("url",
> constant("http://localhost:8088/cmd=ls%20/tmp/unlock
> ")).bean(ShellBeanService.class)
> </code>
> I believe a nice feature would be to allow to go to a particular point in
> the case of a failure. I am unsure how to achieve that though.
> I would appreciate any feedback on this.
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message