Vert.x is a lightweight, high performance application platform for the JVM that's designed for modern mobile, web, and enterprise applications...
Never block the EventLoop!
© http://www.flickr.com/photos/27620885@N02/2602771507/ by Rovert Ferrell D
Bundle up your stuff!
public class Receiver extends Verticle {
@Override
public void start() {
vertx.eventBus().registerHandler("news-feed", new Handler>() {
@Override
public void handle(Message message) {
System.out.println("Received news: " + message.body());
}
});
}
}
public class Sender extends Verticle {
@Override
public void start() {
// Publish some news on the feed every second
vertx.setPeriodic(1000, new Handler() {
@Override
public void handle(Long timerID) {
vertx.eventBus().publish("news-feed", "more news!");
}
});
}
}
Hmmm... so polyglot? Time to see it in action
public class ServerExample extends Verticle {
@Override
public void start() {
vertx.createHttpServer().requestHandler(new Handler() {
public void handle(HttpServerRequest req) {
req.response().headers().set(
"Content-Type", "text/html; charset=UTF-8");
req.response().end(
"<html><body><h1>Hello from Vert.x!</h1></body></html>");
}
}).listen(8080);
}
}
var vertx = require('vertx')
vertx.createHttpServer().requestHandler(function(req) {
req.response.end(
"<html><body><h1>Hello from Vert.x!</h1></body></html>");
}).listen(8080);
vertx.createHttpServer().requestHandler { req ->
req.response.end
"<html><body><h1>Hello from Vert.x!</h1></body></html>"
}.listen(8080, "localhost")
It's opensource for a good reason