In this tutorial we'll show you how to set custom connection and read timeout on Feign Client. These timeouts could be set both for all Feign Clients in your application, or per specific client by adding parameters to application.yml file. Before we jump to the example, it's important to mention that values represent the number of milliseconds.
We'll set default custom timeout for Fegin client this way:

feign:
  client:
    config:
      default:
        connect-timeout: 20000
        read-timeout: 20000

And for specific Feign, you'll name specific feign client:

feign:
  client:
    config:
      SomeFeignClient:
        connect-timeout: 20000
        read-timeout: 20000


When you're defining this timeout you should add both of them, otherwise, the application will not consider them and will use default timeouts - 10s for connection and 60s for read timeout. The time needed for TCP handshake represents connection timeout, while the time needed to read data from the socket is the read timeout.

Pin It

Newsletter

Please enable the javascript to submit this form