The next-gen polyglot asynchronous platform
https://github.com/eclipse/vert.x
@vertx_project
Vert.x is a lightweight, high performance application platform for the JVM that's designed for modern mobile, web, and enterprise applications...
© http://www.flickr.com/photos/56223083@N06/5514161603/
As waiting is b0ring....
But synchronous / blocking IO served me well! Again, why should I care ?
Usually a Thread takes memory from 256kb to 1mb for the stack space!
Ouch....
© http://www.flickr.com/photos/djjasoncook/8608405432/
© http://www.flickr.com/photos/brizzlebornandbred/6136653327/
© http://www.flickr.com/photos/stavos52093/9645884201/
Don't block the Event-Loop
© http://www.flickr.com/photos/1000photosofnewyorkcity/5550289939/
© http://www.flickr.com/photos/kevincollins123/5353373997/
© http://www.flickr.com/photos/s3a/4686060603/
EventBus... Receive and Sent messages
© http://www.flickr.com/photos/94585506@N05/8614340534/
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
© http://www.flickr.com/photos/virar-/4644450720/
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")
© http://www.flickr.com/photos/legofenris/4499417549/
You may want to buy my book...
http://www.manning.com/maurer/
© http://www.flickr.com/photos/64260010@N07/5853626947/
© http://www.flickr.com/photos/photomequickbooth/3531951972/