Skip to content

Instantly share code, notes, and snippets.

@smaldini
Last active June 8, 2017 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smaldini/d407cc9f9a1d13bbde6dcd93166df8c7 to your computer and use it in GitHub Desktop.
Save smaldini/d407cc9f9a1d13bbde6dcd93166df8c7 to your computer and use it in GitHub Desktop.
Flux<Integer> intFlux = Flux.range(1, 1000)
//2
//old: test=baseSubscriber
//next: test=baseSubscriber_range
.contextualize((old, next) -> next.put("test", old.get("test") + "_range"))
.flatMap(d -> Flux.just(d)
//4 (x1000)
//old: test=baseSubscriber_range
//next: test=baseSubscriber_range_innerFlatmap
.contextualize((old, next) -> next.put("test", old.get("test") + "_innerFlatmap")))
.map(d -> d)
.distinct()
//3
//old: test=baseSubscriber_range
//next: test=baseSubscriber_range_distinct
.contextualize((old, next) -> next.put("test", old.get("test") + "_distinct"))
.subscribe(new BaseSubscriber<Integer>() {
//1
//old: [empty]
//next: test=baseSubscriber
@Override
public Context pullContext() {
return Context.empty()
.put("test", "baseSubscriber");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment