Have you tried encapsulating both the HTTP invocation + the JSON
unmarshalling behind a direct: endpoint? i.e.

from("direct:doHttpInvocation")
       .to("http://localhost:8088/?cmd=ls%20/tmp/unlock";)
       .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.

Regards,

*Raúl Kripalani*
Principal Consultant | FuseSource Corp.
[email protected] | fusesource.com <http://www.fusesource.com/>
skype: raul.fuse | twitter: @raulvk <http://twitter.com/raulvk>,
@fusenews<http://twitter.com/fusenews>

<http://twitter.com/fusenews>


On 21 May 2012 22:13, Nestor Urquiza <[email protected]> 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:
> http://camel.465427.n5.nabble.com/Best-practice-to-parse-JSON-response-and-retry-if-error-tp5711530p5713181.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Reply via email to