Hard WebClient & WebFlux
HTTP Error Fallback Pattern
Traducción al español en progresoEl contenido detallado de esta lección aún se está traduciendo. Mientras tanto, se muestra en inglés.
Simulate a WebClient call that fails. Create fetchFromPrimary() that returns Mono.error(RuntimeException("Service unavailable")). Create fetchFromFallback() that returns Mono.just("Fallback data"). Chain them with onErrorResume and print the result.
This pattern is critical for resilient microservices.
Esperado
Fallback data
Main.kt