Hi guys,

I need to call a custom HTTP service that returns JSON. Within the JSON
response I get the "error" field in which case I want to retry. I figured I
can use the http component, unmarshal the result, call a Processor which
checks for the error in which case it throws an Exception. Then an Error
handler can retry. The problem is when it fails it retries the Processor of
course. The question is how can I force to retry http? Perhaps there is just
a simpler way to do this of course. 

from("seda:queue.sample")
        .errorHandler(defaultErrorHandler()
                .log(log)
                .maximumRedeliveries(5)
                .backOffMultiplier(2)
                .useExponentialBackOff()
                .redeliveryDelay(1000)
                .maximumRedeliveryDelay(10000)
                .retryAttemptedLogLevel(LoggingLevel.WARN))
        .log(LoggingLevel.DEBUG, LOG_NAME, "Received message in queue
sample: id = ${id}")
        .to("http://localhost:8088/?cmd=ls%20/tmp/unlock";)
        .unmarshal().json(JsonLibrary.Jackson, ShellResponse.class)
        .process(new ShellProcessor())
        .log(LoggingLevel.DEBUG, LOG_NAME, "Process succesfully unlocked");

Thanks!
-Nestor

--
View this message in context: 
http://camel.465427.n5.nabble.com/Best-practice-to-parse-JSON-response-and-retry-if-error-tp5711530.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to