Closed fiorenzino closed 6 years ago
Very good idea!
I created my implementation of your Server class (using the code inside io.vertx.core.Starter class): https://github.com/fiorenzino/redpipe/blob/REDPIPE12/redpipe-engine/src/main/java/net/redpipe/engine/core/Server.java
My Server version, use the config.json to initialize vertx ( i changed your code to scan the config file in java way, without use the vertx filesystem, beacause vertx will be started using the same file).
But we have two problems:
I think we should use a more robust vertx start mechanism like io.vertx.core.Starter.
WDYT?
Sorry I can't really check the diff because you changed indentation, so I'm not sure what changes you made.
I think the conf/config.json
should be resolved in the CWD of the current application, not in the root project. That's what makes the most sense.
Otherwise Starter
is deprecated, and seems to be a main
entry point, which is not going to work for us, no?
The 2 principal changes in my code:
1 - load file config using java Scanner instead of vertx.filesystem (because the vertx will start using the config.json options)
private Single
2 - init vertx using the file config.json translated in JsonObject:
private Single
The Starter (deprecated) or the Launcher, are the equivalent of our Server: they are the deployer of Verticles. In our case, we need only the code where they run the Vertx instance, using the configuration passed to the Server. The method complete, interesting for us is: io.vertx.core.Starter.startVertx(boolean clustered, boolean ha, Args args)
Can you share your code formatter profile? In some project i use https://github.com/forge/core/blob/master/eclipse-code-formatter-profile.xml
I'm using the default Eclipse formatting: one tab per level.
Closing as it is now supported, I also added some docs. Thanks a lot!
Reading the net.redpipe.engine.core.Server code, the vertx instance is always started using no options:
VertxOptions options = new VertxOptions(); options.setWarningExceptionTime(9223372036854775807L); this.vertx = Vertx.vertx(options);
We could use the "conf/config.json" properties to init vertx: VertxOptions vertxOptions = new VertxOptions(jsonObject);
and like said VertxOptionsConverter.fromJson, we can configure all the vertx options: addressResolverOptions, blockedThreadCheckInterval, clusterHost, clusterPingInterval, clusterPingReplyInterval, clusterPort, clusterPublicHost, clusterPublicPort, clustered, eventBusOptions, eventLoopPoolSize, fileResolverCachingEnabled, haEnabled, haGroup, internalBlockingPoolSize, maxEventLoopExecuteTime, maxWorkerExecuteTime, metricsOptions, preferNativeTransport, quorumSize, warningExceptionTime, workerPoolSize