0

I'm making integration with a web service. There is an api post method that can return a "good" response with a body like:

{
    "result": "Ok"
}

or if something bad happens it returns this:

{
    "result": "Failure"
}

I need to retry the POS request until i get a good answer. Could anyone advice some technique to deal with this?

There are few more retry cases that depend on other response field values, but i think that the result property example shows the problem.

It seems, that using RetryTemplate would fit, but i'm not sure how to handle ths case with RetryState. Any suggestions?

darth jemico
  • 605
  • 2
  • 9
  • 18

1 Answers1

0

If you want to keep trying forever, use an AlwaysRetryPolicy in the RetryTemplate; check the result and throw an exception for failures.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179