Code Explainers
Code explainers tagged #retry
java
@Configuration @EnableKafka public class KafkaErrorHandlingConfig {
Kafka retry and dead-letter handling in Spring
kafka
error-handling
retry
Intermediate
7 steps
java
@Component public class OrderRecoveryHandler { private final RabbitTemplate rabbitTemplate;
Dead-letter recovery with Spring AMQP
dead-letter-queue
retry
exponential-backoff
Advanced
9 steps
typescript
type QueuedRequest = { id: string; url: string; method: string;
A retry queue with exponential backoff
retry
exponential-backoff
persistence
Intermediate
10 steps
php
public function transaction(callable $callback, int $maxAttempts = 3): mixed { $attempt = 0;
Retrying database deadlocks in PHP
retry
transactions
deadlock
Intermediate
8 steps
typescript
import { HttpService } from '@nestjs/axios'; import { Injectable, Logger, ServiceUnavailableException } from '@nestjs/common'; import { AxiosError } from 'axios'; import { catchError, firstValueFrom, retry, timer } from 'rxjs';
Resilient payment retries in NestJS
retry
exponential-backoff
rxjs
Advanced
8 steps
java
@Service public class PaymentGatewayClient { private static final Logger log = LoggerFactory.getLogger(PaymentGatewayClient.class);
Resilient payment calls in Spring
circuit breaker
retry
fault tolerance
Intermediate
7 steps
javascript
const DEFAULT_OPTIONS = { method: 'GET', timeout: 5000, retries: 3,
A resilient fetch wrapper with retries and timeout
fetch
retry
timeout
Intermediate
8 steps
go
package httpx import ( "net/http"
A retrying HTTP transport in Go
http
middleware
retry
Intermediate
8 steps
rust
use std::time::Duration; use tokio::time::sleep; #[derive(Debug)]
Async retry with exponential backoff in Rust
retry
exponential-backoff
async
Intermediate
8 steps
java
public final class RetryExecutor { private final int maxAttempts; private final Duration initialDelay;
Exponential backoff retry in Java
retry
exponential-backoff
jitter
Intermediate
8 steps
java
@Service public class PaymentGatewayClient { private static final Logger log = LoggerFactory.getLogger(PaymentGatewayClient.class);
Resilient payment calls with Spring Retry
retry
backoff
fault-tolerance
Intermediate
7 steps
javascript
const RETRIABLE_STATUS = new Set([408, 429, 500, 502, 503, 504]); function sleep(ms, signal) { return new Promise((resolve, reject) => {
Retrying fetch with exponential backoff
retry
exponential-backoff
abort-signal
Advanced
8 steps
php
<?php namespace App\Support;
Retry with exponential backoff in PHP
retry
exponential-backoff
error-handling
Intermediate
7 steps
typescript
type RetryOptions = { retries?: number; timeoutMs?: number; baseDelayMs?: number;
Retry with timeout and backoff in TypeScript
promises
retry
exponential-backoff
Intermediate
10 steps
java
@Entity @Table(name = "accounts") public class Account {
Optimistic locking with @Version in Spring
optimistic-locking
jpa
concurrency
Advanced
7 steps
typescript
import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable, throwError, timer } from 'rxjs'; import { mergeMap, retryWhen } from 'rxjs/operators';
Exponential backoff retries in Angular
retry
exponential-backoff
rxjs
Advanced
7 steps
python
import random import time import logging from functools import wraps
A retry decorator with exponential backoff
decorators
retry
exponential-backoff
Intermediate
6 steps
go
package retry import ( "context"
Retry with exponential backoff in Go
retry
exponential-backoff
jitter
Intermediate
8 steps