1 Star 0 Fork 2

nie/vertx-examples

forked from githubsync/vertx-examples 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
JokeService.java 1.27 KB
一键复制 编辑 原始数据 按行查看 历史
Julien Viet 提交于 2020-12-08 18:00 +08:00 . Zipkin examples
package io.vertx.example.zipkin;
import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.example.tracing.ChuckNorrisJokesVerticle;
import io.vertx.pgclient.PgConnectOptions;
import io.vertx.tracing.zipkin.ZipkinTracingOptions;
import org.testcontainers.containers.PostgreSQLContainer;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
public class JokeService {
public static void main(String[] args) throws InterruptedException, ExecutionException, TimeoutException {
PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>();
postgres.start();
PgConnectOptions options = new PgConnectOptions()
.setPort(postgres.getMappedPort(5432))
.setHost(postgres.getContainerIpAddress())
.setDatabase(postgres.getDatabaseName())
.setUser(postgres.getUsername())
.setPassword(postgres.getPassword());
Vertx vertx = Vertx.vertx(new VertxOptions()
.setTracingOptions(new ZipkinTracingOptions().setServiceName("JokeService"))
);
vertx.deployVerticle(new ChuckNorrisJokesVerticle(options))
.toCompletionStage()
.toCompletableFuture()
.get(30, TimeUnit.SECONDS);
System.out.println("JokeService started");
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jhnie/vertx-examples.git
git@gitee.com:jhnie/vertx-examples.git
jhnie
vertx-examples
vertx-examples
4.x

搜索帮助