In our project we use ElasticSearch as our search backend. We started seeing some unable to connect exceptions and then decided to add retry logic to our queries. To do so in an ordered manner we use the Transient Fault Handling Application Block (“topaz”) and a custom transient error strategy.
As we were implementing “topaz” we also decided to add a timeout value for our queries so that the client would not be stuck on long running queries. Basically if the query fails after X amount of time we should return an error message and the client can then retry.
Combined we wanted a simple retry logic with timeout on each retry. This is what our calling code looks like:
Our custom retry strategy is super simple: