-
Notifications
You must be signed in to change notification settings - Fork 5
/
VerticleDeployer.java
38 lines (31 loc) · 1.18 KB
/
VerticleDeployer.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package org.genericsystem.watch;
import java.nio.file.Paths;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.DeploymentOptions;
import io.vertx.core.Future;
import io.vertx.core.Verticle;
import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.core.spi.cluster.ClusterManager;
import io.vertx.spi.cluster.hazelcast.HazelcastClusterManager;
public class VerticleDeployer extends AbstractVerticle {
public static void deployVerticle(Verticle verticle) {
ClusterManager mgr = new HazelcastClusterManager();
VertxOptions vertxOptions = new VertxOptions().setClustered(true).setClusterManager(mgr);
Vertx.clusteredVertx(vertxOptions, res -> {
if (res.succeeded()) {
Vertx vertx = res.result();
vertx.deployVerticle(verticle, new DeploymentOptions());
} else {
throw new IllegalStateException(res.cause());
}
});
}
@Override
public void start(Future<Void> startFuture) throws Exception {
DeploymentOptions options = new DeploymentOptions().setWorker(true);
vertx.deployVerticle(new PdfWatcherVerticle(Paths.get("..", "gs-cv", "pdf")), options);
vertx.deployVerticle(new PdfsConverterVerticle(), options);
startFuture.complete();
}
}