5. What is vert.x?
General purpose application platform
Superficially similar to Node.js – but not a clone!
Asynchronous APIs
Polyglot – mix and match Java, JavaScript/CoffeeScript, Ruby, Groovy
and Python (others to follow).
Simple but not Simplistic
Part of the new breed of application platforms
5
6. Key Features
Hybrid Reactor
Polyglot Container
TCP/SSL clients and servers
HTTP/HTTPS clients and servers – including WebSockets
File system
Event bus
100% asynchronous
6
7. Code!
Super simple HTTP server
Serves files by matching request path
One example for each language
7
14. More languages?
DynJS
100% InvokeDynamic
Alternative to Rhino for JavaScript
Node.js Compatibility for vert.x
Clojure?
What language support do you want see?
14
16. Threading Model
Vert.x implements the Multi-Reactor Pattern
An event loop is an OS thread
Handles events for many handlers
Vert.x has multiple event loops. Typically one per core.
Don't block the event loop!
16
17. Hybrid Threading Model
Don't force everything to run on an event loop
Worker verticles can block
Communicate with other verticles by message passing.
Allows us to leverage the huge ecosystem of blocking Java libs
17
18. Components
Server & Client
TCP
HTTP
WebSocket
SockJS
Event Bus
Point-to-point, publish-subscribe
Transparent clustering
18
19. Event Bus
The nervous system of Vert.x
Verticles communicate using the event bus.
Super simple API.
Point to point. Publish/Subscribe. Request/Response.
Pass simple strings, numbers or other primitive types.
JSON messages are preferred for structured data.
Transparent clustering
19
20. Event Bus – Example
var handler = function(message) {
console.log('Received message ' + message.msg)
}
vertx.eventBus.registerHandler('example.address', handler)
vertx.setPeriodic(1000, function() {
vertx.eventBus.send('example.address', { msg: 'foo’ })
})
20
21. Event Bus – Extended to 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
21
22. Modules
Authentication Manager ■ Web Server
Form Upload ■ Work Queue
JDBC Persistor ■ AMQP
Mailer ■ More…
Mongo Persistor
Session Manager
22
24. Composition
Deploy code using code
Modules are unit of composed code
Deploy modules using a verticle
Or provide multiple verticles inside a module
Remember: verticles communicate using the Event Bus.
24
25. Architecture
I/O verticles
Logic
verticles
Separation of concerns
Workers if required Event
Bus
Polyglot
Worker
verticle
25
27. Big Fast Data
Realtime Analytics Dashboards & APIs
WebSocket
SockJS
Polyglot Integration
Use language independent format like JSON, XML for data
Exchange messages using event bus
27
28. Fast Data – RabbitMQ
AMQP message broker
Use for queuing, routing messages and WAN clustering
28
29. Big/Fast Data – Redis
“Data Structure Server”
Key-Value store
Pub-sub messaging
Use for caching verticle data, broadcasting to verticles
29
30. Big/Fast Data – GemFire
Compute Grid / Distributed Cache
Embeddable Key-Value store
Use for large partitioned caches, high performance compute,
WANs
Send data to vert.x using CacheListeners, subscriptions,
AsyncQueues
30
31. Big Data – Hadoop
Hive – of course!
SQL queries via JDBC worker verticle
Standard pattern via event bus
Use for ad-hoc queries on large datasets
31
32. Big Data – MQTT
MQTT is a machine-to-machine (M2M) / "Internet of Things”
connectivity protocol.
Extremely lightweight publish/subscribe messaging transport.
It is useful for connections with remote locations where a small
code footprint is required and/or network bandwidth is at a
premium.
Eclipse Paho
Coming soon!
32
33. Big Data – Intravert (@zznate - apigee)
Processors, filters and procedures allow you perform arbitrary
programmatic transformations on the server side before the results are
returned to the client.
Execute procedures and join like logic in a single RPC request
eliminating round-trips
A simple transport and JSON API that runs over HTTP allows clients to
choose from JSON, JSON compressed by smile, & even big fat sexy
XML
A real REST interface (ever thought about what would a Cassandra
hyper media API look like?)
Work with simple familiar objects like String or Integer instead of bytes
33
34. v2.0 – Features
New ClassLoader
Netty 4.0
Languages as modules
Flexible Module repositories, including Maven
Management
34
35. v2.0 – Developer experience
Gradle template project
Maven archetype and plugins
Zero setup IDE debugging
Zero setup IDE testing
Test Tools project
35
37. Real Deployment
vert.x provides a JSON RPC API:
deployer.js
JsonRpcServer.groovy
Integration.groovy – worker
Spring Integration message flow to RabbitMQ
Dynamically deploys components to consume queues:
Consumer.groovy – worker, Spring Integration message flow
JsonRpcClient.groovy
37
38. Real Deployment
I/O verticles Worker Verticles
HTTP Spring Integration
JSON RPC AMQP publisher
Event
Bus
HTTP Spring Integration (Groovy DSL)
JSON RPC Client AMQP Consumer
38
39. Summary
Write apps as set of loosely coupled components that live
anywhere
Polyglot – use the language(s) you want
Simple concurrency – wave goodbye to most race conditions
Leverage existing Java library ecosystem
Module system – empower the community
Run Node.js apps too
We believe Vert.x is the platform for the new generation of
polyglot web and enterprise applications 39