Presented at JAX London 2013
Vert.x is a lightweight, high performance, application platform for the JVM that's designed for modern mobile, web, and enterprise applications. The recent Vert.x 2.0 release marks a coming of age for Vert.x, as it progresses to a fully independent project. We'll dive into the Vert.x 2.0 release and show how the powerful new module system enables a Vert.x ecosystem by allowing modules to be re-used via Maven and Bintray repositories. You'll also learn about how better build tool and IDE integration makes developing applications with Vert.x a breeze.
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Introducing Vert.x 2.0 - Taking polyglot application development to the next level - Tim Fox (Red Hat)
1. Vert.x 2
Taking polyglot application
development to the next level
Tim Fox
Vert.x Project Lead
Red Hat
twitter:@timfox
2. Bio
■ Employed By Red Hat to lead the Vert.x project
■ Some projects I've been involved with: Vert.x (creator), RabbitMQ,
HornetQ (creator), JBoss AS, Mobicents...
3. Project Info
■ Independent Community Project
■ The main project is an Eclipse Foundation project
■ All code is on GitHub
■ 100% open source (ASL 2.0 + Creative Commons)
■ One of the most popular Java projects on GitHub
4. Vert.x Overview
■ Lightweight reactive application platform
■ Polyglot
■ High performance
■ Superficially similar to Node.js – but not a clone!
■ Asynchronous APIs
■ Simple but not simplistic
■ Embeddable
6. Core Asychronous APIs
■ TCP/SSL clients and servers
■ HTTP/HTTPS clients and servers
■ Websockets
■ SockJS
■ File system
■ Event bus
■ DNS (new)
■ UDP (new)
■ Core is small and static – most new functionality in modules
■ Don't call us, we'll call you!
7. Why Asynchronous?
■ Modern servers need to handle many connections – web servers,
websockets, IoT
■ OS threads are still a precious resource
■ Need to service many connections with small number of threads
■ Blocked OS threads means they can't do other work
8. Verticle
■ Execution unit of Vert.x
■ Single threaded – less scope for race conditions
■ Verticles communicate by message passing
■ Sounds like the Actor Model?
9. Simple web server demo
■ Vertx run webserver.js
■ Show code in gedit
■ Explain about raw verticles
■ Also show WebServer.java
■ Run it too
■ Talk about Java source verticles
11. Event Bus
■ The nervous system of Vert.x
■ Verticles send messages over the event bus
■ Point to point. Publish/Subscribe. Request/Response
■ Pass strings, buffers, primitive types or JSON
■ JSON messages are preferred for structured data
12. Clustered Event Bus
■ Lightweight peer-to-peer messaging system
■ Connects multiple Vert.x JVM instances
■ Applications are loosely coupled components distributed across your
network
■ No monolithic “application server”
■ Cluster manager is pluggable, default is Hazelcast
■ Cluster manager used for group management, not transport
13. Event bus in the Browser
■ Event bus extends to client side JavaScript too
■ Uses the same API on the client
■ Powerful distributed event space spanning both client and server
nodes
■ Ideal for modern “real-time” web applications
14. Clustered event bus demo
■ receiver.js and Sender.java
■ Show code
■ Show messages being received
■ Start bridge (need 3rd console for this)
■ Show browser receiving messages too
15. Modules
■ Modules encapsulate code and resources
■ One or more modules per application
■ Must include a mod.json descriptor file
■ Can be runnable or non runnable
■ Module class-loaders provide isolation
16. Explore module demo
■ Look at a simple runnable module on disk
■ Show the mod.json
■ It's a simple TCP echo server
■ Run it with vertx runmod
17. An ecosystem of modules
■ Sharing modules encourages reuse
■ Modules can be pushed to any Maven or Bintray repository
■ Vert.x can resolve modules at build time or run time
■ Want to encourage an ecosystem of modules
■ Register your modules in the registry
18. Module resolve demo
■ Delete the module that we explored in the last example
■ Do a vertx runmod on it again
■ Explore the mods directory again
19. It's all about the modules
■ MongoDB
■ Redis
■ Facebook
■ Yoke
■ MySQL/PostgreSQL
■ SMTP
■ Stomp
■ BSON
■ JDBC
■ Jersey
■ work-queue
■ NoDyn
■ Promises
■ Guice
■ GCM
■ SocketIO
■ Spring
■ Vertigo
■ Sessions
■ Via
■ Metrics
■ RxJava
20. Fat jars
■ Build module into self contained "fat" executable jar
■ Convenient for devops
■ Fairly small overhead
21. Fat jar demo
■ Do vertx fatjar of the module from before
■ Take a look at the jar, look at its size
■ Execute it
■ Maybe unzip it and look inside
22. High Availability
■ Automatic failover of deployed modules
■ Nodes can be grouped
■ Network partition detection with quora
23. HA demo
■ Keep bridge running from before
■ Use one Scala sender.scala module and one Groovy
sender module
■ Start them both with -ha flag
■ Look at browser
■ Kill one ps aux | grep Sender.java
■ Look at browser again
■ Start an empty vertx
■ Fail it back
24. Developing with Vert.x
■ Vert.x is IDE and build system agnostic
■ Can just a text editor if you like
■ Maven archetype
■ Gradle template
■ Debug and test in IDE
■ Module auto-redeploy during development
25. Auto-redeploy demo
■ Show Maven project in eclipse
■ Project is module with sender.rb in it
■ mvn vertx:runModEclipse
■ Look at browser
■ Make change
■ Look at browser again
26. Summary
■ Write apps as set of loosely coupled components that live anywhere
where you want
■ Polyglot – use the language(s) you want
■ Simple concurrency – wave goodbye to most race conditions
■ Module system – empower the community
■ High availability
■ Ease of development
We believe Vert.x is the platform for the new generation of reactive
polyglot web and enterprise applications
27. Get involved!
■ Loads more to do
■ Active and growing community
■ Github: https://github.com/vert-x/vert.x
■ Google group: vertx
■ IRC channel: #vertx on freenode.net