Book Image

Real-time Web Application Development using Vert.x 2.0

By : Tero Parviainen
Book Image

Real-time Web Application Development using Vert.x 2.0

By: Tero Parviainen

Overview of this book

<p>Vert.x is a platform for building highly networked and scalable applications on the Java Virtual Machine. Using just a few powerful building blocks, it provides a powerful framework that scales to a multitude of different usage scenarios. It is one of the few truly polyglot development platforms, providing seamless interoperability between components written in JavaScript, CoffeeScript, Java, Ruby, Python, and Groovy.</p> <p>Real-time Web Application Development using Vert.x 2.0 will show you how to get up and running on the powerful Vert.x platform. Using a hands-on example of developing a mind map editor, this book shows you how to build a Vert.x application from the ground up, and on the way introduces all of the major building blocks of Vert.x, such as integrating with a database, polyglot development, and so on.</p> <p>Real-time Web Application Development using Vert.x 2.0 will guide you step-by-step through building a Vert.x application so that you’ll be able to start building one of your own in no time. From initiation to scaling, you’ll develop a mind map editor application with real-time collaboration capabilities. As you go through the development process, you’ll get to know all the building blocks of Vert.x applications: Verticles, Worker Verticles, the Event Bus, and Modules. You’ll also see how Vert.x apps seamlessly reach into client devices by building a client application using the Vert.x Event Bus Bridge, Knockout.js, and D3.js.</p> <p>Real-time Web Application Development using Vert.x 2.0 guides you through the whole Vert.x application development process, tying all of the important concepts together with a simple, realistic example application.</p>
Table of Contents (13 chapters)

Deploying the module


Our export verticle is completed, but we haven't integrated it into the rest of our application yet. Vert.x doesn't automatically deploy modules from the mods directory. You always need to deploy them explicitly. Let's do that from the deployment verticle app.js:

var container = require("vertx/container");
container.deployModule("io.vertx~mod-web-server~2.0.0-final", {
  port: 8080,
  host: "localhost",
  bridge: true,
  inbound_permitted: [
    { address: 'mindMaps.list' },
    { address: 'mindMaps.create' },
    { address: 'mindMaps.delete' },
    { address_re: 'mindMaps\\.editor\\..+' },
    { address: 'com.vertxbook.svg2png' }
  ],
  outbound_permitted: [
    { address_re: 'mindMaps\\.events\\..+' }
  ]
});
container.deployModule("io.vertx~mod-mongo-persistor~2.0.0-final", {
  address: "mindMaps.persistor",
  db_name: "mind_maps"
});
container.deployVerticle('mindmaps.js');
container.deployVerticle('mindmap_editor.js');
container.deployModule('com.vertxbook~mod-svg2png...