A Hitchikers Introduction 0 to Vertx - Eclipse49 Hitchhikers Introduction to Vertx Recap Vertx is a...
Transcript of A Hitchikers Introduction 0 to Vertx - Eclipse49 Hitchhikers Introduction to Vertx Recap Vertx is a...
BASEL BERN BRUGG DÜSSELDORF FRANKFURT A.M. FREIBURG I.BR. GENF HAMBURG KOPENHAGEN LAUSANNE MÜNCHEN STUTTGART WIEN ZÜRICH
A Hitchikers Introduction to Vertx
Anatole Tresch, Principal Consultant
0
2 Hitchhikers Introduction to Vertx
About me...
● Principal Consultant, Trivadis AG (Switzerland)● Star Spec Lead JSR 354● Open Source Enthusiast
● Twitter: @atsticks● [email protected]● [email protected]●
3 Hitchhikers Introduction to Vertx
Agenda
● Basics
● Networking
● Clustering
● Vertx Maven Plugin
● There is more...
Vertx?Is that something
to eat?
5 Hitchhikers Introduction to Vertx
Tool-kit
for reactive applications
on the JVM
6 Hitchhikers Introduction to Vertx
● Vert.x is not a container.
● You use the components you like.
● You can combine Vert.x with all the other libraries
you like.
Toolbox
7 Hitchhikers Introduction to Vertx
Reactive
Source: http://www.reactivemanifesto.org/
8 Hitchhikers Introduction to Vertx
Core
● TCP/HTTP client and server, Datagram Sockets
● Event bus● Shared data● Periodic and delayed actions● Verticles● DNS client● File system access● HA and Clustering
9 Hitchhikers Introduction to Vertx
Starting
10 Hitchhikers Introduction to Vertx
The Eventloop
● Events are distributed by the event loop thread aka Reactor
● Vertx = Multi-Reactor (by default Cores*2)
● Don‘t block the event loop !!!
11 Hitchhikers Introduction to Vertx
Running Blocking Code
12 Hitchhikers Introduction to Vertx
The Event Bus
● The nervous system of Vert.x.
● One single event bus instance for every Vert.x instance.
● Allows different parts of your application to communicate.
● Can be bridged to support client side JavaScript.
● A distributed peer-to-peer messaging spanning multiple nodes and browsers.
● Publish/subscribe, point to point, and request-response messaging.
13 Hitchhikers Introduction to Vertx
Registering Handlers to the Event Bus
14 Hitchhikers Introduction to Vertx
Publishing Events on the Event Bus
15 Hitchhikers Introduction to Vertx
Acknowledging Messages
16 Hitchhikers Introduction to Vertx
Delivery Options
17 Hitchhikers Introduction to Vertx
JSON Support
● Vertx comes with full JSON OOTB (based on Jackson Library)
● JSON can is by default support over the event bus
● JsonObject.encode()/JsonArray.encode() → String
18 Hitchhikers Introduction to Vertx
High Availability
Verticles can be deployed with High Availability enabled:
19 Hitchhikers Introduction to Vertx
Buffers
20 Hitchhikers Introduction to Vertx
Verticles● Simple, scalable, actor-like deployment and concurrency model
● Not a strict actor-model implementation, but similar
● Entirely optional
21 Hitchhikers Introduction to Vertx
22 Hitchhikers Introduction to Vertx
Verticle Types
23 Hitchhikers Introduction to Vertx
Deploying Verticles
Or you use references for VerticleFactories for polyglot support,,,
24 Hitchhikers Introduction to Vertx
Timers and Delays
One shot timers:
Periodic timers:
25 Hitchhikers Introduction to Vertx
Shared Data● Local shared maps
● Cluster-wide asynchronous maps
● Cluster-wide locks & counters (not shown)
Networking
27 Hitchhikers Introduction to Vertx
TCP Server
28 Hitchhikers Introduction to Vertx
TCP Server Reading/Writing
29 Hitchhikers Introduction to Vertx
TCP Client
30 Hitchhikers Introduction to Vertx
HTTP Server
31 Hitchhikers Introduction to Vertx
HTTP Client
32 Hitchhikers Introduction to Vertx
Vertx Web
Provides more flexible support for writing web services.
33 Hitchhikers Introduction to Vertx
Vertx Web – Basic Routing
34 Hitchhikers Introduction to Vertx
Vertx Web – Rest Endpoint
35 Hitchhikers Introduction to Vertx
Vertx Web – Rest Endpoint
36 Hitchhikers Introduction to Vertx
Vertx CircuitBreaker
37 Hitchhikers Introduction to Vertx
Vertx ServiceDiscovery
38 Hitchhikers Introduction to Vertx
Vertx ServiceDiscovery – Provider Sample
39 Hitchhikers Introduction to Vertx
Vertx ServiceDiscovery – Consumer Sample
Clustering & HA
41 Hitchhikers Introduction to Vertx
Clustering
42 Hitchhikers Introduction to Vertx
High Availability
Vertx Maven Plugin
44 Hitchhikers Introduction to Vertx
Vertx Maven Plugin
I want to see a demo.
Please give me more.
46 Hitchhikers Introduction to Vertx
Not discussed...● Vertx CLI● MQTT Client/Server● Configuration● Metrics Support● Health-Checks● Shell● Test Support● Service Proxies● Openshift / Docker Tooling● JDBC● NoSql Support● Advanced:
● Code Generation, Language Bindings, etc
47 Hitchhikers Introduction to Vertx
Demo Time ...
Recap
49 Hitchhikers Introduction to Vertx
Recap
● Vertx is a very flexible and modular toolkit
● It is rather leightweight (ca. 6 MB for something useful)
● It is polyglot, supporting a big range of languages
● It is amazing fast
● It supports all requirements of the reactive manifesto
● It sometimes can be a beast
● It requires Java 8+
● It is fun to work with
Hitchhikers Introduction to Vertx
A Hitchhikers Introduction to VertxAnatole TreschPrincipal Consultant
Tel. +41 58 459 53 [email protected]
Vertx: http://vertx.io
Vertx Maven Plugin: https://vmp.fabric8.io/
Reactive Manifesto: http://www.reactivemanifesto.org/