Handling automatic retry in Jetty Client

In Jetty 8, there used to be this:

But I don’t see any equivalent in new API nor any mention in:

And as per this answer it does not seem to be possible:

How can I configured maxRetries and the methods that are allowed to be retried in Jetty client ?

I am looking for something similar to this:

Answer

The TLDR answer is that you have to write your own retry listener.

In this way, you have full control on the retry delay policy, whether or not to change URI, or method, etc.

Furthermore, automatic retry give the false impression that they are available for all requests, but a request with non-reproducible content (e.g. one read from an InputStream that can be consumed only once) cannot be retried.

Also, non-idempotent requests should not be retried.

In summary, there is too much custom logic that will be best implemented by applications rather than by Jetty.

Leave a Reply

Your email address will not be published. Required fields are marked *