3

What is the use case for using vertx.clusteredVertx using javascript?

I can start vertx from command line in clustered mode using:

vertx run server.js --cluster

I can (in my server.js file) create another vertx instance using:

var Vertx = require("vertx-js/vertx");
var options = {};
Vertx.clusteredVertx(options, function (res, res_err) {
    if (res_err == null) {
        var vertx = res;
        console.log("We now have a cluster");
    } else {
        console.log("Failed: " + res_err);
    }
});

But then vertx gives me a warning:

You're already on a Vert.x context, are you sure you want to create a new Vertx instance?

So what is the use case for that API (when Vertx is not embedded)?

Tereska
  • 751
  • 1
  • 7
  • 25

1 Answers1

0

--cluster is useful if you have configured your clustering using external files or other environment settings.

Clustering allows multiple vertx instances to share an event bus and other data (in vertx.sharedData()). If you do not need this functionality, you do not need clustering.

DoctorPangloss
  • 2,994
  • 1
  • 18
  • 22