Vert.x is a lightweight, high performance application platform for the JVM that's designed for modern mobile, web, and enterprise applications.


Polyglot


Write your application components in Java, JavaScript, CoffeeScript, Ruby, Python or Groovy...

... or mix and match several programming languages in a single app.

Simplicity


...without being simplistic.

Simple, powerful, APIs enable you to write non-blocking network enabled applications with ease. No complex configuration or boilerplate required.

Scalability


Scales using messaging passing to efficiently utilise your server cores.

Uses non blocking I/O to serve many connections with minimal threads.

Concurrency


Simple actor-like concurrency model frees you from the pitfalls of traditional multi-threaded programming.



Key Features



  • The Distributed Event Bus is the nervous system of Vert.x and connects your server-side components.

    Write your components in whatever language you want, and put them where you want on your network. It even penetrates into JavaScript running in the browser!

  • WebSockets and SockJS support for real-time server-push applications.

  • If you don't want the whole platform, Vert.x can be embedded as a library in your existing Java applications.

  • Vert.x has a powerful module system. Package your Vert.x components into modules for encapsulation and reuse.

    Share them with the community by putting them in Maven Central, any other Maven repository, or in Bintray.

    Advertise your module in the module registry.

  • Seamlessly code, run, debug and test your Vert.x applications in your favourite IDE.

    Get started using Maven using the Maven archetype or using Gradle with the example Gradle template project.

    Use auto-redeploy to see your changes instantly in a running module.

  • 100% open source. Licensed under the Apache Software License 2.0


Here's an example web-server*


Save the following in server.js

  var vertx = require('vertx');

  vertx.createHttpServer().requestHandler(function(req) {
      var file = req.path() === '/' ? 'index.html' : req.path();
      req.response.sendFile('webroot/' + file);
  }).listen(8080)
                  

Run it:

vertx run server.js

Save the following in Server.java

  import org.vertx.java.core.Handler;
  import org.vertx.java.core.http.HttpServerRequest;
  import org.vertx.java.platform.Verticle;

  public class Server extends Verticle {
      public void start() {
          vertx.createHttpServer().requestHandler(new Handler<HttpServerRequest>() {
              public void handle(HttpServerRequest req) {
                  String file = req.path().equals("/") ? "index.html" : req.path();
                  req.response().sendFile("webroot/" + file);
              }
          }).listen(8080);
      }
  }
                  

Run it: (note no compile is needed!)

vertx run Server.java

Save the following in server.rb

  require "vertx"

  Vertx::HttpServer.new.request_handler do |req|
      file = req.uri == "/" ? "index.html" : req.uri
      req.response.send_file "webroot/#{file}"
  end.listen(8080)
                  

Run it:

vertx run server.rb

Save the following in Server.groovy

  vertx.createHttpServer().requestHandler { req ->
      def file = req.uri == "/" ? "index.html" : req.uri
      req.response.sendFile "webroot/$file"
  }.listen(8080)
                  

Run it:

vertx run Server.groovy

Save the following in server.py

  import vertx

  server = vertx.create_http_server()

  @server.request_handler
  def request_handler(req):
      file = "index.html" if req.uri == "/" else req.uri
      req.response.send_file("webroot/%s"%file)
  server.listen(8080)
                  

Run it:

vertx run server.py

Save the following in server.clj

  (ns example.server
  (:require [vertx.http :as http]))

  (-> (http/server)
    (http/on-request
      (fn [req]
        (let [uri (.uri req)]
          (-> req
            (http/server-response)
            (http/send-file (str "webroot/" (if (= "/" uri) "index.html" uri)))))))
    (http/listen 8080))                
                  

Run it:

vertx run server.clj

* In a real production web-server you would want to do some checking of the path to ensure files aren't served from outside the webroot!