Function: http.default_retry_predicate

Simple default retry predicate for idempotent targets.

If your target is non-idempotent, use default_retry_predicate_non_idempotent instead.

Retries on 429 (Too Many Requests), 502 (Bad Gateway), 503 (Service unavailable), and 504 (Gateway Timeout), as well as on any ConnectionError, ConnectionFailedError, and TimeoutError.

For more information, see Retry steps.

Arguments

Arguments
exception The error to apply the retry criterion upon.

Returns

true when the retry criterion is satisfied, false otherwise.

Examples

# Make an HTTP request using a standard retry predicate
# and custom maximum retries and backoff parameters
- read_item:
    try:
      call: http.get
      args:
        url: https://example.com/someapi
      result: api_response
    retry:
      predicate: ${http.default_retry_predicate}
      max_retries: 5
      backoff:
        initial_delay: 2
        max_delay: 60
        multiplier: 2

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.