Reactive Vert.x

1,511 views

Published on

The benefits of using reactive extensions with Vert.x.

Talk given at the Vancouver Reactive Programmers Meetup: http://www.meetup.com/Vancouver-Reactive-Programmers/events/181183662/

Related source code: https://github.com/ddossot/vertx-react-demo

Published in: Technology, Business
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,511
On SlideShare
0
From Embeds
0
Number of Embeds
35
Actions
Shares
0
Downloads
24
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide

Reactive Vert.x

  1. 1. REACTIVE
  2. 2. = Erlang + Node.js + Polyglot ―――――――――――― JVM http://vertx.io
  3. 3. Event-Driven Message passing Event bus Non-blocking IO
  4. 4. Scalable Distributed event-bus Location transparency Clustered in-memory cache
  5. 5. Resilient Module and verticle isolation Worker processes Automatic HA failover
  6. 6. Responsive “Don't block the event loop!” Time-outs Event-bus “back pressure”
  7. 7. Java Ruby Scala Clojure Python Groovy JavaScript ... PHP
  8. 8. Polyglot Friction Andrew Cholakian http://blog.andrewvc.com/vertx-node-on-ropes
  9. 9. Why ? https://rx.codeplex.com/
  10. 10. https://github.com/Netflix/RxJava https://github.com/vert-x/mod-rxvertx
  11. 11. Callback Hell eventBus.<JsonObject> sendWithTimeout(metricsAddress, METERS_BUS_REQUEST, 1000L, ar1 -> { JsonObject metersData = ar1.succeeded() ? ar1.result().body() : new JsonObject(); eventBus.<JsonObject> sendWithTimeout(metricsAddress, HISTOGRAMS_BUS_REQUEST, 1000L, ar2 -> { JsonObject histogramData = ar2.succeeded() ? ar2.result().body() : new JsonObject(); processData(metersData.mergeIn(histogramData)); }); });
  12. 12. Callback Help Observable<JsonObject> observeMeters = eventBus.<JsonObject, JsonObject> send(metricsAddress, METERS_BUS_REQUEST) .map(msg -> msg.body()) .timeout(1L, SECONDS, from(new JsonObject())); Observable<JsonObject> observeHistograms = eventBus.<JsonObject, JsonObject> send(metricsAddress, HISTOGRAMS_BUS_REQUEST) .map(msg -> msg.body()) .timeout(1L, SECONDS, from(new JsonObject())); zip(observeMeters, observeHistograms, (jo1, jo2) -> jo1.mergeIn(jo2)) .subscribe(data -> processData(data));
  13. 13. http://careers.unbounce.com @ddossot

×