Skip to content

Instantly share code, notes, and snippets.

@stfsy
Created July 24, 2023 00:52
Show Gist options
  • Save stfsy/d42e549a8b67001743d793343f25a1b1 to your computer and use it in GitHub Desktop.
Save stfsy/d42e549a8b67001743d793343f25a1b1 to your computer and use it in GitHub Desktop.
Supplier<String> supplier = () -> service.sayHelloWorld(param1);
String result = Decorators.ofSupplier(supplier)
.withBulkhead(Bulkhead.ofDefaults("name"))
.withCircuitBreaker(CircuitBreaker.ofDefaults("name"))
.withRetry(Retry.ofDefaults("name"))
.withFallback(asList(CallNotPermittedException.class, BulkheadFullException.class),
throwable -> "Hello from fallback")
.get()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment