Vert.x offers developers a simple way to define service interfaces with its Service Proxy module. The idea is that a developer defines a Java interface and that is the contract between the services across the Vert.x cluster.

Until now this protocol was only implemented in Java so all the polyglot users would not benefit from it, but was this a limitation?

No, just because the contract is a Java interface it does not mean that it cannot be implemented by any other language. For example, say that you have the contract:

public interface MyService {

  void sayHello(Handler<AsyncResult<String>> handler);

  static MyService createProxy(Vertx vertx, String address) {
    return ProxyHelper.createProxy(MyService.class, vertx, address);

  static void registerService(Vertx vertx, String address, MyService service) {
    ProxyHelper.registerService(MyService.class, vertx, service, address);

One can easily implement this in JavaScript and expose on the cluster as:

var Future = require('vertx-js/future');
var MyService = require('jetdrone-services-js/my_service');
// force nashorn to convert to this type later on
var JMyService = Java.type('');

  // this is the JS facade
  new MyService(
    // this is the Java Interface implementation
    new JMyService({
      sayHello: function (handler) {
        handler.handle(Future.succeededFuture('Hello there!'));

For the full example, see here.

Paulo Lopes

I'm Paulo and I've used my 10+ years of software development experience writing, rewriting, banging my head against the wall, editing and re-editing high-performance web application to make Vert.x an even more awesome framework.

pmlopes pml0p35 pmlopes