Reactive Internet of Thins : the Vert.x way

29
Meet{cast} powered by Paolo Patierno Senior Software Engineer (Messaging & IoT) @ Red Hat @ppatierno Reactive Internet of Things : the Vert.x way

Transcript of Reactive Internet of Thins : the Vert.x way

  • Meet{cast}

    powered by

    Paolo PatiernoSenior Software Engineer (Messaging & IoT) @ Red Hat

    @ppatierno

    Reactive Internet of Things : the Vert.x way

  • powered by

    Senior Software Engineer @ Red HatMessaging & IoT team

    Microsoft MVPEmbedded & IoT ( I like to call it in this way )

    Eclipse committerHono (lead as well)Paho

    I love everything is open code, standards, protocols, even pizza, running, MotoGP :-)

    Who am I ?

  • powered by

    What is Vert.x ?Vert.x IoT enabled components

    MQTT serverAMQP ProtonKafka client

    Use casesEclipse HonoEnMasse

    Agenda

  • powered by

    Vert.x is a toolkit ... for building distributed and reactive applications ... running on a JVM ... using an asynchronous non-blocking model and its polyglot !

    What is Vert.x

  • powered by

    Vert.x (Core) is just a JARVert.x components are just JARsYour application has just some JAR dependencies (classpath,

    fat-jar, ...)

    Toolkit

  • powered by

    Different (micro)services inside your network which ...is not reliablehas a latencyhas a finite bandwidth

    The topology can changeBe prepared to fail !

    Distributed

  • powered by

    Responsive : respond in a acceptable timeElastic : scale up and downResilient : designed to handle failures gracefullyMessage driven : interact using asynchronous messages

    http://www.reactivemanifesto.org

    Reactive

    responsive

    elastic resilient

    messagedriven

    http://www.reactivemanifesto.org/

  • powered by

    JavaGroovyRubyJavaScript (Nashorn)CeylonKotlinScala

    Polyglot

  • powered by

    The Event Loop

  • powered by

    Multiple Event Loops

  • powered by

    Non blocking I/O vs blocking

  • powered by

    Scalability

  • powered by

    A piece of code that can be deployed by Vert.xSimilarities with the Actor Model, where you can think a

    verticle as an actorVerticles communicate using an event busThey are optional

    Verticles

  • powered by

    Communication system within Vert.xDifferent components can communicate using it ...

    sending and receiving messages (one way, request/reply, publish/subscribe)

    whatever the language is (polyglot)wherever they run (even not on Vert.x, thanks to bridges)

    Main topics :message : with a body and headers, JSON encodedaddress : messages are sent to an addresshandler : messages are received by handlers

    Event Bus

  • powered by

    Event Bus

    point to pointpublish/subscribe

    request/reply

  • powered by

    Event Bus

    clustered

    bridges

  • powered by

    An IoT solution is distributed by natureHaving a toolkit means using only what you need in each

    pieceIoT applications need to be reactive

    responsive, elastic scale, reliable and asynchronousDifferent teams (or companies ?) ...

    with different know-how need to be polyglot

    Vert.x & the Internet of Things

  • powered by

    Its not a broker !Provides a server for

    handling connection requests from remote MQTT clientshandling all the communication, encoding/decoding on the wirehandling message exchanges as defined by the protocol (3.1.1)

    The API provides :events raised when raw protocol messages are receivedmethods for sending messages to remote clients

    MQTT server

  • powered by

    Provides a wrapper around Apache Qpid Proton AMQP 1.0 protocol engine

    The API provides : client for connecting to an AMQP 1.0 server/brokerhandling of sessions and links inside a connectionsend/receive messages, flow control all great AMQP 1.0 stuff :-)server for accepting connections from AMQP 1.0 clients

    AMQP Proton

  • powered by

    Provides a Kafka client for reading/sending messages from/to an Apache Kafka cluster

    The API provides : subscribing to a topic as part of a consumer groupassigning specific topic partitionsending messages to a topicusing a shared producer

    Kafka client

  • powered by

    Tailored general messaging for IoT solutionsProvide messaging APIs for common operationsSupport multiple IoT protocols (MQTT, AMQP, HTTP, LWM2M,...)Support different underlying messaging infrastracture :

    Qpid Dispatch Router + ActiveMQ ArtemisJMSEnMasseKafkaRabbitMQ

    Eclipse Hono

  • powered by

    IoT messaging APIs telemetry : used by devices to send data downstreamdevice registration : register, deregister and get information about

    devicesevent : used by devices to send events downstream (i.e. alarms, ...)command & control : used by business applications to send

    commands to devicesIoT protocol adapters

    HTTP RESTMQTT

    Scalable messaging architecture

    Eclipse Hono

  • powered by

    Eclipse Hono and Vert.x ?

  • powered by

    A MaaS (Message as a Service) platformElastic scale messaging based on Qpid Dispatch Router and Artemis

    running on OpenShiftSupport different communication patterns

    store and forward : queue & topic/subscriptionsdirect messaging : anycast & multicast

    Support different protocolsAMQP 1.0, MQTT, HTTP, Stomp

    Multitenancy

    EnMasse

  • powered by

    EnMasse

    addresscontroller

    ragent

    configserv

    queuescheduler

    mqttgateway

    mqttlwt

    subserv

    messaging mqtt-gateway

    mqtt-lwt

    subscriptionmyqueue mytopic

    admin

    clientsapplication developer

    OpenShiftservices

  • powered by

    Target IoT Platform

    Linux containers, Kubernetes, OpenShift

    BrokerBroker

    AM

    QP

    -Kaf

    kaAdapters

    AM

    QP

    -Spa

    rk

    Adapters

    AMQP

    MQTT, HTTP, CoAP,

    AMQP

    MQTT, HTTP, CoAP,

    DispatchRouter

  • powered by

    Vert.x : http://vertx.ioVert.x MQTT server : https://github.com/vert-x3/vertx-mqtt-server Vert.x AMQP Proton : https://github.com/vert-x3/vertx-proton Vert.x Kafka client : https://github.com/vert-x3/vertx-kafka-client Eclipse Hono : https://www.eclipse.org/hono/ EnMasse : https://github.com/EnMasseProject ActiveMQ Artemis : https://activemq.apache.org/artemis/ Qpid Dispatch Router : http://qpid.apache.org/components/dispatch-router/ Apache Kafka : https://kafka.apache.org/AMQP-Kafka bridge : https://github.com/EnMasseProject/amqp-kafka-bridge Paolo Patiernos blog : https://paolopatierno.wordpress.com/ :-)

    Resources

    http://vertx.io/https://github.com/vert-x3/vertx-mqtt-serverhttps://github.com/vert-x3/vertx-protonhttps://github.com/vert-x3/vertx-kafka-clienthttps://www.eclipse.org/hono/https://github.com/EnMasseProjecthttps://activemq.apache.org/artemis/http://qpid.apache.org/components/dispatch-router/https://kafka.apache.org/https://github.com/EnMasseProject/amqp-kafka-bridgehttps://paolopatierno.wordpress.com/

  • powered by

    If you like Vert.x !If you are a student !Google Summer of Code ideas using Vert.x : http://vertx.io/gsoc/

    Google Summer of Code

    http://vertx.io/gsoc/

  • powered by

    Thanks !

    ppatierno

    Slide 1OverviewBrainstorming ObjectivesRulesSlide 5Brainstorming ActivitySummarizeNext StepsSlide 9Slide 10Slide 11Slide 12Slide 13Slide 14Slide 15Slide 16Slide 17Slide 18Slide 19Slide 20Slide 21Slide 22Slide 23Slide 24Slide 25Slide 26Slide 27Slide 28Slide 29