Reputation: 771
How to pass VertxOptions from command line (like worker threads)?
I'm talking about something like this:
java -jar fat.jar --workerThreads 40
or
vertx run server.js --workerThreads 40
There is no mention of that parameter in manual or API.
Is there any way to do this?
I know that there is an API:
var Vertx = require("vertx-js/vertx");
var vertx = Vertx.vertx({
"workerPoolSize" : 40
});
But when I use that API I get warning from Vertx:
You're already on a Vert.x context, are you sure you want to create a new Vertx instance?
So I thinking I am doing something wrong...
Upvotes: 4
Views: 1446
Reputation: 580
You need to put it as a system property with a vertx.options prefix.
So for the fat jar it would be:
java -jar fat.jar -Dvertx.options.workerThreads 40
As for what properties you can set, anything that has a setting in VertxOptions has a corresponding property name: the setter name without the "set" portion.
For example, in code:
options.setClusterPort(5555)
is equivalent to
-Dvertx.options.clusterPort
on the command line.
Be warned that the "vertx.options" part is case-sensitive.
Upvotes: 3