Retry Example

This example shows request-level retry using retry.if, optional retry.stopIf, and exponential backoff.

name: RetryExample
rounds:
  - name: RetryRound
    numberOfClients: 1
    iterations:
      - name: RetryOnServerErrors
        mode: R
        requestCount: 1
        httpRequest:
          capture:
            to: LastResponse
            as: Json
            makeGlobal: false
          url: https://httpbin.org/status/500
          method: GET
          retry:
            if: ${LastResponse.StatusCode} >= 500
            stopIf: ${LastResponse.StatusCode} = 400
            maxRetries: 5
            delayInMs: 1000
            strategy: Exponential
            maxDelayInMs: 11000

What It Demonstrates

  • Conditional retry with retry.if
  • Optional early stop with retry.stopIf
  • Exponential backoff using delayInMs with optional maxDelayInMs cap
  • Response capture for status-code-based retry decisions