Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Modern app programming with RxJava and Eclipse Vert.x

Modern app programming with RxJava and Eclipse Vert.x

With the advent of mobile web and IoT (Internet of Things), today's applications need to handle a lot of concurrent requests while staying responsive and easy to scale. Infrastructure plays a role in achieving these goals, but changing your programming style can help too.

In this presentation, we will make the case for reactive programming, and introduce RxJava in particular. Then we will guide you through the process of building a real-life web application, based on Vert.x 3 and RxJava, communicating with databases, external services and modern datastores. You will learn how Vert.x integrates with RxJava, and why its simplicity makes it a perfect runtime for reactive applications.

Thomas Segismont

November 23, 2017
Tweet

More Decks by Thomas Segismont

Other Decks in Technology

Transcript

  1. Who am I? • Thomas Segismont • tsegismont on GitHub,

    Twitter, Gmail, Freenode... • Vert.x core team since August 2016 • At Red Hat since November 2012 (RHQ and Hawkular)
  2. Expectations • Goals – Why should you consider learning Vert.x

    and RxJava? – What does RxJava look like? Vert.x? – How can I combine them to build scalable, efficient and resilient apps? • Non goals – In-depth study of RxJava or Vert.x
  3. Event loop benefits • Mechanical sympathy – Get more from

    your hardware • Simple concurrency model – No complex multithreaded code bugs • Easier to scale – More predictable behavior under load
  4. What is Vert.x • Toolkit (lib) • Non blocking •

    Event-driven • Polyglot (on the JVM) • Fast and lightweight
  5. Events • Http server request • Buffer read from a

    file • Server bound to port • Message from the bus Single thread
  6. Event Bus • Nervous system of Vert.x • Message passing

    style • Different messaging paradigms: – Point to point – Publish/Subscribe – Request/Reply • Clustered (browser included!) • Bridges (TCP, Java, Go)
  7. Running blocking code • In the real world, most JVM

    libraries have blocking APIs – JDBC – io.File – Your legacy libs – Heavy computation • With Vert.x you can interact with blocking parts easily • You won’t throw away your code assets!
  8. Use cases • Where does it really shine? – API

    Gateways / Edge Services – Microservices – Cloud (slice of a slice of CPU) – Embedded (IoT)
  9. A bit of history • Started at MSFT with .NET

    • Provide developers with tools for the apps of 21st century – API economy – Multiple actors – Operating on various systems at different speeds
  10. Data and events flows • Everything is a stream! –

    Mouse clicks – HTTP buffers – EventBus messages – Database rows
  11. Different flavors Zero One Many Sync void T Iterable<T> Async

    Completable Single<T> Observable<T> Flowable<T> And in RxJava2 : Maybe (one or none or error)