Vert.x

vert.x
Original author(s) Tim Fox
Developer(s) Tim Fox, VMWare, Red Hat, Eclipse Foundation
Stable release
3.3.3 / September 16, 2016 (2016-09-16)[1]
Repository https://github.com/eclipse/vert.x, https://github.com/vert-x3/
Development status Active
Written in Java, JavaScript, Groovy, Ruby, Python, Scala, Clojure
Operating system Cross-platform
Platform Java Virtual Machine
Type Event-driven networking
License Apache License version 2.0
Website vertx.io

Vert.x is a polyglot event-driven application framework that runs on the Java Virtual Machine.[2][3]

Similar environments written in other programming languages include Node.js for JavaScript, Twisted for Python, Perl Object Environment for Perl, libevent for C and EventMachine for Ruby.

As of version 2.1.4, Vert.x exposes its API in Java, JavaScript, Groovy, Ruby, Python, Scala, Clojure and Ceylon.

As of version 3.2.1, Vert.x exposes its API in Java, JavaScript, Groovy, Ruby and Ceylon.

History

Vert.x was started by Tim Fox in 2011 while he was employed by VMware.

Fox initially named the project "Node.x", a play on the naming of Node.js, with the "x" representing the fact that the new project was polyglot in nature, and didn't simply support JavaScript. The project was later renamed to "Vert.x" to avoid any potential legal issues as "Node" was a trademark owned by Joyent Inc.[4] The new name was also a play on the name node, as a vertex is a synonym for a node in mathematics.

In December 2012, after he left their employment, VMware served legal papers on Tim Fox to take control of the Vert.x trademark, domain name, blog, Github account, and Google Group from the Vert.x community[5][6]

After much discussion with other parties, in January 2013, VMware was persuaded that it would be in the best interests of the Vert.x community to move the project and associated IP to the Eclipse Foundation, a neutral legal entity.[7]

In August 2013, the core Vert.x project completed its move to the Eclipse Foundation. The other projects that make up the Vert.x stack did not migrate to Eclipse but continued to use the "Vert.x" trademark with tacit approval of the Eclipse Foundation.

In May 2014, Vert.x won the award for "Most Innovative Java Technology" at the JAX Innovation awards.[8]

On January 12, 2016, Tim Fox stepped down as the lead of the Vert.x project.[9] and Julien Viet, a long time contributor, took his place.

Architecture

Vert.x uses low level IO library Netty.[10]

The application framework includes these features:

Examples

A web server serving static files could be written in Java:

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

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

And in Clojure:

(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))

Both cases will result in a web server serving content in a highly scalable manner.

Note that these examples are not fit for production use, since the server is open to directory traversal attacks. More complete examples for web servers are available in the vert.x examples repository.

References

This article is issued from Wikipedia - version of the 10/31/2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.