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

Démystifier le réactif et l'orchestration de services avec Vert.x, Kubernetes et Kotlin

Démystifier le réactif et l'orchestration de services avec Vert.x, Kubernetes et Kotlin

Julien Ponge

March 29, 2018
Tweet

More Decks by Julien Ponge

Other Decks in Programming

Transcript

  1. Julien Ponge Maitre de Conférences “Delegated consultant to Red Hat”

    on Vert.x Eclipse Golo + extensive F/OSS background ! https://julien.ponge.org/ " @jponge # @jponge  https://www.mixcloud.com/hclcast/
  2. data class Person(val name: String, val age: Int) fun String.yo()

    { println("$this -> Yo!") } fun wrap(block: () -> Unit) { println("{{{") block() println("}}}") } fun main(args: Array<String>) { wrap { val phil = Person(name="Philippe", age=45) println(phil) phil.name.yo() } }
  3. data class Person(val name: String, val age: Int) fun String.yo()

    { println("$this -> Yo!") } fun wrap(block: () -> Unit) { println("{{{") block() println("}}}") } fun main(args: Array<String>) { wrap { val phil = Person(name="Philippe", age=45) println(phil) phil.name.yo() } }
  4. data class Person(val name: String, val age: Int) fun String.yo()

    { println("$this -> Yo!") } fun wrap(block: () -> Unit) { println("{{{") block() println("}}}") } fun main(args: Array<String>) { wrap { val phil = Person(name="Philippe", age=45) println(phil) phil.name.yo() } }
  5. data class Person(val name: String, val age: Int) fun String.yo()

    { println("$this -> Yo!") } fun wrap(block: () -> Unit) { println("{{{") block() println("}}}") } fun main(args: Array<String>) { wrap { val phil = Person(name="Philippe", age=45) println(phil) phil.name.yo() } } {{{ Person(name=Philippe, age=45) Philippe -> Yo! }}}
  6. Reactive systems Reactive streams Reactive programming Reactive “Responding to stimuli”

    Manifesto, Actor, Messages Resilience, Elasticity, Scalability, Asynchronous, non-blocking Data flow Back-pressure Non-blocking Data flow Events, Observable Spreadsheets Akka, Vert.x Akka Streams, RxJava, Reactor, Vert.x Reactor, Reactive Spring, RxJava, Vert.x
  7. while (isRunning) { String line = bufferedReader.readLine(); switch (line.substring(0, 4))

    { case "ECHO": bufferedWriter.write(line); break // ... // other cases ( ...) // ... default: bufferedWriter.write("UNKW Unknown command"); } }
  8. Eclipse Vert.x Open source project started in 2012 Eclipse /

    Apache licensing A toolkit for building reactive applications for the JVM 7K ⋆ on ' Built on top of ! https://vertx.io " @vertx_project
  9. ( ) ( Http server verticle Database client verticle 

    Event Bus + ) “Details for user 1234?” “{data}” 4 instances 1 instance
  10.  Verticles ( ( ( public class SomeVerticle extends AbstractVerticle

    { @Override public void start() throws Exception { } @Override public void stop() throws Exception { } } class SomeVerticle : AbstractVerticle() { override fun start() { } override fun stop() { } } exports.vertxStart = function() { } exports.vertxStop = function() { }
  11. fun main(args: Array<String>) { val rand = Random() val o1

    = Observable .fromCallable(rand ::nextInt) .repeat() .take(500, TimeUnit.MILLISECONDS) .filter { it > 0 } .filter { it % 2 == 0 } .map { "[${it}]" } val o2 = Observable.fromIterable(1 ..Long.MAX_VALUE) Observables .zip(o1, o2) { n, id -> "${id} -> ${n}" } .subscribeBy( onNext = logger ::info, onError = { logger.error("Oh?") }, onComplete = { logger.info("Done!") } ) } “id -> [n]” zip()
  12. Unified end-to-end reactive model + ecosystem (not just APIs…) For

    all kinds of distributed applications (even the small-scale ones) Flexible toolkit, not a framework (your needs, your call)
  13. https: //youtu.be/ZkWsilpiSqw - Applications réactives avec Eclipse Vert.x . Building

    Reactive Microservices in Java https: //goo.gl/ep6yB9 . Guide to async programming with Vert.x for Java developers https: //goo.gl/AcWW3A