本文整理汇总了Java中io.vertx.servicediscovery.types.HttpEndpoint.getWebClient方法的典型用法代码示例。如果您正苦于以下问题:Java HttpEndpoint.getWebClient方法的具体用法?Java HttpEndpoint.getWebClient怎么用?Java HttpEndpoint.getWebClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.vertx.servicediscovery.types.HttpEndpoint
的用法示例。
在下文中一共展示了HttpEndpoint.getWebClient方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: example3_webclient
import io.vertx.servicediscovery.types.HttpEndpoint; //导入方法依赖的package包/类
public void example3_webclient(ServiceDiscovery discovery) {
HttpEndpoint.getWebClient(discovery, new JsonObject().put("name", "some-http-service"), ar -> {
if (ar.succeeded()) {
WebClient client = ar.result();
// You need to path the complete path
client.get("/api/persons")
.send(response -> {
// ...
// Dont' forget to release the service
ServiceDiscovery.releaseServiceObject(discovery, client);
});
}
});
}
示例2: evaluate
import io.vertx.servicediscovery.types.HttpEndpoint; //导入方法依赖的package包/类
@Override
public void evaluate(Handler<AsyncResult<Double>> resultHandler) {
// ----
// First we need to discover and get a HTTP client for the `quotes` service:
HttpEndpoint.getWebClient(discovery, new JsonObject().put("name", "quotes"),
client -> {
if (client.failed()) {
// It failed...
resultHandler.handle(Future.failedFuture(client.cause()));
} else {
// We have the client
WebClient webClient = client.result();
computeEvaluation(webClient, resultHandler);
}
});
// ---
}
示例3: getWebClient
import io.vertx.servicediscovery.types.HttpEndpoint; //导入方法依赖的package包/类
public void getWebClient(Function<Record, Boolean> filter, Handler<AsyncResult<WebClient>> handler) {
HttpEndpoint.getWebClient(serviceDiscovery, filter, handler);
}
示例4: retrieveAuditService
import io.vertx.servicediscovery.types.HttpEndpoint; //导入方法依赖的package包/类
private Future<WebClient> retrieveAuditService() {
Future<WebClient> future = Future.future();
HttpEndpoint.getWebClient(discovery, new JsonObject().put("name", "audit-service"), future);
return future;
}