Skip to content

Instantly share code, notes, and snippets.

@jeroenr
Created November 28, 2019 14:23
Show Gist options
  • Save jeroenr/3326d42c87d5b995492c4ea95d8bdd99 to your computer and use it in GitHub Desktop.
Save jeroenr/3326d42c87d5b995492c4ea95d8bdd99 to your computer and use it in GitHub Desktop.
interface Service {
Flux<String> observe();
Mono<Void> save(String s);
}
class Foo {
private final Service service;
void longRunningProblem() {
service.observe()
.flatMap(service::save, 10)
.doOnTerminate(this::longRunningProblem) // start over on terminate
.subscribeOn(Schedulers.elastic())
.retry() // retry indefinitely
.subscribe();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment