Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

What's new in Reactor Californium

150 vues

Publié le

What's new in Reactor Californium, the 3rd release train (3.2.x) of Project Reactor.

Publié dans : Technologie
  • Soyez le premier à commenter

What's new in Reactor Californium

  1. 1. Reactor Californium Stephane Maldini - @smaldini
  2. 2. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
  3. 3. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 3 But Really ? Californium ?
  4. 4. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 4
  5. 5. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Just Released 5
  6. 6. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactor Core 3.2 Reactor Addons 3.2 Reactor Netty 0.8 6
  7. 7. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 7 Used by
 Spring Framework 5.1
  8. 8. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Used by
 Spring Framework 5.1 8 (And Soon® 
 Spring Boot 2.1)
  9. 9. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactor Core 3.2
  10. 10. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Initial Micrometer Support 10 Monitor Flux and Mono
  11. 11. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Initial Micrometer Support 11 New metric() operator with auto detection for name() and tag()
  12. 12. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Initial Micrometer Support 12 Noop if Micrometer not on class path
  13. 13. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Initial Micrometer Support 13 Flux.range(1, 1000) .delayUntil(i -> Mono.delay(Duration.ofMillis(100*(i % 10)))) .name("test-flow") .log() .metrics() .limitRate(10) .repeat() .blockLast();
  14. 14. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Initial Micrometer Support 14 Flux.range(1, 1000) .delayUntil(i -> Mono.delay(Duration.ofMillis(100*(i % 10)))) .name("test-flow") .log() .metrics() .limitRate(10) .repeat() .blockLast(); Identify the flux for meaningful metrics
  15. 15. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Initial Micrometer Support : Good to know 15 Time delays between start and data signals… …Then between each data signals Time full flow duration if finite Tag by signal type Detect Malformed Reactive Signals
  16. 16. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Initial Micrometer Support w/ Spring Boot 16 compile "io.projectreactor:reactor-core:3.2.0.RELEASE" compile "org.springframework.boot:spring-boot-starter-webflux" compile "org.springframework.boot:spring-boot-starter-actuator" compile "io.micrometer:micrometer-registry-prometheus"
  17. 17. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Initial Micrometer Support w/ Spring Boot 17 compile "io.projectreactor:reactor-core:3.2.0.RELEASE" compile "org.springframework.boot:spring-boot-starter-webflux" compile "org.springframework.boot:spring-boot-starter-actuator" compile "io.micrometer:micrometer-registry-prometheus"
  18. 18. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 18
  19. 19. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ reactor.util.context.Context: reactive flow attributes 19 Reward end-to-end users with unique features in 3.2
  20. 20. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ reactor.util.context.Context: reactive flow attributes 20 Immutable container using optimized copy-on-write
  21. 21. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ reactor.util.context.Context: reactive flow attributes 21 Propagate at subscribe time from the subscribing side to the producing side.
  22. 22. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ reactor.util.context.Context: reactive flow attributes 22 StepVerifier.create( Mono.subscriberContext() .subscriberContext(Context.of("initial", "value")) ) .expectNextMatches(c -> c.hasKey("initial")) .verifyComplete();
  23. 23. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ reactor.util.context.Context: reactive flow attributes 23 StepVerifier.create( Mono.subscriberContext() .subscriberContext(Context.of("initial", "value")) ) .expectNextMatches(c -> c.hasKey("initial")) .verifyComplete(); Read from the current subscription Write during current subscription
  24. 24. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ reactor.util.context.Context: reactive flow attributes 24 StepVerifier.create( Flux.just("foo") .flatMap(v -> Mono.subscriberContext()) .subscriberContext(Context.of("initial", "value")) ) .expectNextMatches(c -> c.hasKey("initial")) .verifyComplete();
  25. 25. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ reactor.util.context.Context: reactive flow attributes 25 StepVerifier.create( Flux.just("foo") .flatMap(v -> Mono.subscriberContext()) .subscriberContext(Context.of("initial", "value")) ) .expectNextMatches(c -> c.hasKey("initial")) .verifyComplete(); Works inside nested flows
  26. 26. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Context: an alternative to Thread-Local 26 Spring Security Spring Cloud Sleuth doOnDiscard onErrorContinue Spring Data …
  27. 27. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ DoOnDiscard 27 Reroute upstream operators discarded items
  28. 28. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ DoOnDiscard 28 Useful to build strongly consistent reactive flows Even more useful to release resources 
 such as pooled buffers (hello netty!)
  29. 29. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ DoOnDiscard : react to filtered items 29 AtomicInteger discardNumberCount = new AtomicInteger(); Flux.range(1, 12) .filter(i -> i % 2 == 0) .doOnDiscard(Number.class, i -> discardNumberCount.incrementAndGet()) .subscribe(); Assertions.assertThat(discardNumberCount).hasValue(6);
  30. 30. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ DoOnDiscard : react to partial collections 30 DirectProcessor<String> p = DirectProcessor.create(); Disposable d = p.collectList() .doOnDiscard(String.class, System.out::println) .subscribe(); p.onNext("a"); p.onNext("b"); p.onNext("c"); d.dispose();
  31. 31. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ DoOnDiscard : react to cancelled items 31 DirectProcessor<String> p = DirectProcessor.create(); Disposable d = p.collectList() .doOnDiscard(String.class, System.out::println) .subscribe(); p.onNext("a"); p.onNext("b"); p.onNext("c"); d.dispose(); a b c Console Output
  32. 32. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ DoOnDiscard : testable behavior 32 StepVerifier.create(Flux.range(1, 12) .filter(i -> i % 2 == 0) ) .expectNext(2, 4, 6, 8, 10, 12) .expectComplete() .verifyThenAssertThat() .hasDiscarded(1, 3, 5, 7, 9, 11);
  33. 33. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ DoOnDiscard : scope of work 33 Limited number of supported operators
 Planning to add more during 3.2.x
  34. 34. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ DoOnDiscard : scope of work 34 Limited number of supported operators
 Planning to add more during 3.2.x Look for this in JavaDoc
  35. 35. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ DoOnDiscard : scope of work 35 Does not guarantee exactly-once callback invocation combineLatest overlapping buffers overlapping windows
  36. 36. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ DoOnDiscard : scope of work 36 Use your own de-duplication if you need exactly-once semantics
  37. 37. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ onErrorContinue 37 Reroute upstream operators selected errors
  38. 38. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ onErrorContinue 38 Useful to build more resilient reactive flows Even more useful to messaging use cases
 such as data processing pipelines
  39. 39. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ onErrorContinue : keep things running 39 Flux.just(0, 1) .map(i -> 1 / i) .onErrorContinue((e, data) -> System.out.println(e.getMessage() + " - " + data)) .log() .subscribe();
  40. 40. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ onErrorContinue : keep things running 40 Flux.just(0, 1) .map(i -> 1 / i) .onErrorContinue((e, data) -> System.out.println(e.getMessage() + " - " + data)) .log() .subscribe(); A Door left open for errors
  41. 41. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ onErrorContinue : keep things running 41 Flux.just(0, 1) .map(i -> 1 / i) .onErrorContinue((e, data) -> System.out.println(e.getMessage() + " - " + data)) .log() .subscribe(); Console Output [main] INFO reactor.Flux.ContextStart.1 - | onSubscribe([Fuseable] FluxContextStart.ContextStartSubscriber) [main] INFO reactor.Flux.ContextStart.1 - | request(unbounded) / by zero - 0 [main] INFO reactor.Flux.ContextStart.1 - | onNext(1) [main] INFO reactor.Flux.ContextStart.1 - | onComplete()
  42. 42. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ onErrorContinue : keep things running 42 Flux.just(0, 1) .map(i -> 1 / i) .onErrorContinue((e, data) -> System.out.println(e.getMessage() + " - " + data)) .log() .subscribe(); Console Output [main] INFO reactor.Flux.ContextStart.1 - | onSubscribe([Fuseable] FluxContextStart.ContextStartSubscriber) [main] INFO reactor.Flux.ContextStart.1 - | request(unbounded) / by zero - 0 [main] INFO reactor.Flux.ContextStart.1 - | onNext(1) [main] INFO reactor.Flux.ContextStart.1 - | onComplete() / by zero - 0
  43. 43. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ onErrorContinue : keep things running 43 Flux.just(0, 1) .map(i -> 1 / i) .onErrorContinue((e, data) -> System.out.println(e.getMessage() + " - " + data)) .log() .subscribe(); Console Output [main] INFO reactor.Flux.ContextStart.1 - | onSubscribe([Fuseable] FluxContextStart.ContextStartSubscriber) [main] INFO reactor.Flux.ContextStart.1 - | request(unbounded) / by zero - 0 [main] INFO reactor.Flux.ContextStart.1 - | onNext(1) [main] INFO reactor.Flux.ContextStart.1 - | onComplete() onNext(1)
  44. 44. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ onErrorContinue : keep things running 44 Flux.just(0, 1) .flatMap(f -> Mono.just(f).map(i -> 1/i)) .onErrorContinue((e, data) -> System.out.println(e.getMessage() + " - " + data)) .log() .subscribe();
  45. 45. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ onErrorContinue : keep things running 45 Flux.just(0, 1) .flatMap(f -> Mono.just(f).map(i -> 1/i)) .onErrorContinue((e, data) -> System.out.println(e.getMessage() + " - " + data)) .log() .subscribe(); Nested Flows support - Thanks Context !
  46. 46. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ onErrorContinue : scope of work 46 Limited number of supported operators
 Planning to add more during 3.2.x
  47. 47. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ onErrorContinue : scope of work 47 Limited number of supported operators
 Planning to add more during 3.2.x
  48. 48. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ onErrorContinue : scope of work 48 Error must not be related to 
 the start or the end of sequence
  49. 49. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ onErrorContinue : scope of work 49 Impact the way the flow is working As the operator usually needs to request an extra item
  50. 50. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ onErrorContinue : scope of work 50 Impact the way the flow is working As the operator usually needs to request an extra item No use-case for Mono#onErrorContinue
  51. 51. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ retryBackoff : pragmatic retry 51 The new retry operator you will want to use all the time
  52. 52. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ retryBackoff : pragmatic retry 52 The new retry operator you will want to use all the time With randomized exponential timeouts
  53. 53. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ retryBackoff : pragmatic retry 53 The new retry operator you will want to use all the time With randomized exponential timeouts Promoted operator from Reactor Addons 👍
  54. 54. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ retryBackoff : pragmatic retry 54 StepVerifier.withVirtualTime(() -> Mono.error(new IOException("boom retry")) .doOnError(e -> elapsedList.add(Schedulers.parallel().now(TimeUnit.MILLISECONDS))) .retryBackoff(4, Duration.ofMillis(100), Duration.ofMillis(2000)) ) .thenAwait(Duration.ofMinutes(1)) .expectErrorSatisfies(e -> assertThat(e).hasMessage("Retries exhausted: 4/4")) .verify(); System.out.println(elapsedList);
  55. 55. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ retryBackoff : pragmatic retry 55 StepVerifier.withVirtualTime(() -> Mono.error(new IOException("boom retry")) .doOnError(e -> elapsedList.add(Schedulers.parallel().now(TimeUnit.MILLISECONDS))) .retryBackoff(4, Duration.ofMillis(100), Duration.ofMillis(2000)) ) .thenAwait(Duration.ofMinutes(1)) .expectErrorSatisfies(e -> assertThat(e).hasMessage("Retries exhausted: 4/4")) .verify(); System.out.println(elapsedList); pro-tip: use virtual time to instant-test time driven sequences
  56. 56. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ retryBackoff : pragmatic retry 56 StepVerifier.withVirtualTime(() -> Mono.error(new IOException("boom retry")) .doOnError(e -> elapsedList.add(Schedulers.parallel().now(TimeUnit.MILLISECONDS))) .retryBackoff(4, Duration.ofMillis(100), Duration.ofMillis(2000)) ) .thenAwait(Duration.ofMinutes(1)) .expectErrorSatisfies(e -> assertThat(e).hasMessage("Retries exhausted: 4/4")) .verify(); System.out.println(elapsedList); Console Output [0, 129, 386, 749, 1463]
  57. 57. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ usingWhen : Arbitrary resource lifecycle binding 57 Flux<String> flux = Flux.usingWhen(Mono.fromCallable(TestResource::new), d -> Flux.just("Transaction started", "work in transaction", "more work in transaction"), TestResource::commit, TestResource::rollback); StepVerifier.create(flux) .expectNext("Transaction started") .expectNext("work in transaction") .expectNext("more work in transaction") .verifyComplete();
  58. 58. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ usingWhen : Arbitrary resource lifecycle binding 58 Flux<String> flux = Flux.usingWhen(Mono.fromCallable(TestResource::new), d -> Flux.just("Transaction started", "work in transaction", "more work in transaction"), TestResource::commit, TestResource::rollback); StepVerifier.create(flux) .expectNext("Transaction started") .expectNext("work in transaction") .expectNext("more work in transaction") .verifyComplete(); Commit method will be used
  59. 59. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ usingWhen : Arbitrary resource lifecycle binding 59 Flux<String> flux = Flux.usingWhen(Mono.fromCallable(TestResource::new), d -> Flux.just("Transaction started").concatWith(Mono.error(new Exception("fail"))), TestResource::commit, TestResource::rollback); StepVerifier.create(flux) .expectNext("Transaction started") .verifyErrorMessage(“fail"); Rollback method will be used
  60. 60. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ usingWhen : Arbitrary resource lifecycle binding 60 Flux<String> flux = Flux.usingWhen(Mono.fromCallable(TestResource::new), d -> Flux.just("Transaction started").concatWith(Mono.error(new Exception("fail"))), TestResource::commit, TestResource::rollback, TestResource::rollback); StepVerifier.create(flux) .expectNext("Transaction started”) .thenCancel() .verify(); Rollback method will be used on cancel too
  61. 61. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Learn about all improvements 61 https://github.com/reactor/reactor-core/releases/tag/v3.2.0.RELEASE
  62. 62. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Things that are still in the oven 62 Full Processor API refactoring
  63. 63. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Things that are still in the oven 63 Full Processor API refactoring Too impacting for now
  64. 64. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Things that are still in the oven 64 Converting Marble Diagrams to SVG
 Shout Out to @thekalinga  Metrics for Schedulers new FluxSink#tryNext Website improvements
  65. 65. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 65 Learn more from Simon Baslé 3:20 Flight of the Flux: A Look at Reactor Execution Model
  66. 66. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactor Netty 0.8
  67. 67. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ The API refining continues 67 Aligned HttpClient APIs with WebClient Merged Options and Stateless builders
 into XxxClient/XxxServer
  68. 68. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ The API refining continues 68 HttpClient.create() .wiretap() .followRedirect(true) .get() .uri("https://projectreactor.io") .responseContent() .asString() .limitRate(1) .reduce(String::concat) .block(Duration.ofSeconds(30));
  69. 69. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ The API refining continues 69 HttpClient.create() .wiretap() .followRedirect(true) .get() .uri("https://projectreactor.io") .responseContent() .asString() .limitRate(1) .reduce(String::concat) .block(Duration.ofSeconds(30)); Single level of nesting
  70. 70. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ The API refining continues 70 HttpClient.create() .wiretap() .followRedirect(true) .get() .uri("https://projectreactor.io") .responseContent() .asString() .limitRate(1) .reduce(String::concat) .block(Duration.ofSeconds(30)); Specify client options in the builder
  71. 71. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ The API refining continues 71 HttpClient.create() .wiretap() .followRedirect(true) .get() .uri("https://projectreactor.io") .responseContent() .asString() .limitRate(1) .reduce(String::concat) .block(Duration.ofSeconds(30)); Basic decoding OoB
  72. 72. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 72 Learn more from Violeta Georgieva 11:30 Reactor Netty, the Default Spring Boot 2.0 Runtime
  73. 73. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Next ?
  74. 74. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ What’s next ? 74 dysprosium [Dy] ? Dubnium [Db] ? Darmstadtium [Ds] ?
  75. 75. Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Thanks

×