当前位置: 首页>>代码示例>>Java>>正文


Java HttpEndpoint.createRecord方法代码示例

本文整理汇总了Java中io.vertx.servicediscovery.types.HttpEndpoint.createRecord方法的典型用法代码示例。如果您正苦于以下问题:Java HttpEndpoint.createRecord方法的具体用法?Java HttpEndpoint.createRecord怎么用?Java HttpEndpoint.createRecord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.vertx.servicediscovery.types.HttpEndpoint的用法示例。


在下文中一共展示了HttpEndpoint.createRecord方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: example1

import io.vertx.servicediscovery.types.HttpEndpoint; //导入方法依赖的package包/类
public void example1(ServiceDiscovery discovery) {
  Record record1 = HttpEndpoint.createRecord(
    "some-http-service", // The service name
    "localhost", // The host
    8433, // the port
    "/api" // the root of the service
  );

  discovery.publish(record1, ar -> {
    // ...
  });

  Record record2 = HttpEndpoint.createRecord(
    "some-other-name", // the service name
    true, // whether or not the service requires HTTPs
    "localhost", // The host
    8433, // the port
    "/api", // the root of the service
    new JsonObject().put("some-metadata", "some value")
  );

}
 
开发者ID:vert-x3,项目名称:vertx-service-discovery,代码行数:23,代码来源:HTTPEndpointExamples.java

示例2: getMicroServiceRecord

import io.vertx.servicediscovery.types.HttpEndpoint; //导入方法依赖的package包/类
/**
 * Define microservice options
 * servicePort: this is the visible port from outside
 * for example you run your service with 8080 on a platform (Clever Cloud, Docker, ...)
 * and the visible port is 80
 */
static Record getMicroServiceRecord() {
  
  String serviceName = Optional.ofNullable(System.getenv("SERVICE_NAME")).orElse("John Doe");
  String serviceHost = Optional.ofNullable(System.getenv("SERVICE_HOST")).orElse("localhost"); // domain name
  Integer servicePort = Integer.parseInt(Optional.ofNullable(System.getenv("SERVICE_PORT")).orElse("80")); // set to 80 on Clever Cloud
  String serviceRoot = Optional.ofNullable(System.getenv("SERVICE_ROOT")).orElse("/api");
  
  return HttpEndpoint.createRecord(
    serviceName,
    serviceHost,
    servicePort,
    serviceRoot
  );
}
 
开发者ID:the-big-bang-theory,项目名称:penny,代码行数:21,代码来源:Parameters.java

示例3: createRecord

import io.vertx.servicediscovery.types.HttpEndpoint; //导入方法依赖的package包/类
private Record createRecord(final JsonObject item) {
    final String name = item.getString(NAME);
    final String host = item.getString(HOST);
    final Integer port = item.getInteger(PORT);
    final JsonObject meta = item.getJsonObject(META);
    return HttpEndpoint.createRecord(
            name, host, port, "/*", meta
    );
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:10,代码来源:EndPointOrigin.java

示例4: createHttpEndpointRecord

import io.vertx.servicediscovery.types.HttpEndpoint; //导入方法依赖的package包/类
private Record createHttpEndpointRecord(HttpEndpointConfiguration configuration) {
    return HttpEndpoint.createRecord(configuration.getName(),
            configuration.isSsl(),
            configuration.getHost(),
            configuration.getPort(),
            configuration.getRoot(),
            configuration.getMetadata());
}
 
开发者ID:GwtDomino,项目名称:domino,代码行数:9,代码来源:HttpServiceDiscovery.java

示例5: publishRecord

import io.vertx.servicediscovery.types.HttpEndpoint; //导入方法依赖的package包/类
private void publishRecord(ServiceDiscovery discovery, String name, JsonObject service) {
  String host = service.getString("host");
  Integer port = service.getInteger("port");
  if (host != null && port != null) {
    Record record = HttpEndpoint.createRecord(name, host, port, "/");
    record.setLocation(service);
    discovery.publish(record, ar -> {
      if (ar.succeeded()) {
        LOGGER.info("publish record succeeded: {}", ar.result().toJson().encode());
      } else {
        LOGGER.info("publish record failed: {}", record.toJson().encode());
      }
    });
  }
}
 
开发者ID:edgar615,项目名称:direwolves,代码行数:16,代码来源:JsonServiceDiscoveryVerticle.java

示例6: testPublicationWithoutStatus

import io.vertx.servicediscovery.types.HttpEndpoint; //导入方法依赖的package包/类
@Test
public void testPublicationWithoutStatus() {
  AtomicReference<Record> ref = new AtomicReference<>();
  Record record = HttpEndpoint.createRecord("some-service", "localhost");
  discovery.publish(record, ar -> {
    ref.set(ar.result());
  });

  await().untilAtomic(ref, is(notNullValue()));

  assertThat(ref.get().getRegistration()).isNotNull();
  assertThat(ref.get().getStatus()).isEqualTo(Status.UP);
}
 
开发者ID:vert-x3,项目名称:vertx-service-discovery,代码行数:14,代码来源:DiscoveryImplTest.java

示例7: publishHttpEndpoint

import io.vertx.servicediscovery.types.HttpEndpoint; //导入方法依赖的package包/类
public void publishHttpEndpoint(String name, String host, int port, String root, Handler<AsyncResult<Void>>
        completionHandler) {
    Record record = HttpEndpoint.createRecord(name, host, port, root);
    publish(record, completionHandler);
}
 
开发者ID:docker-production-aws,项目名称:microtrader,代码行数:6,代码来源:MicroserviceVerticle.java

示例8: testBridges

import io.vertx.servicediscovery.types.HttpEndpoint; //导入方法依赖的package包/类
@Test
public void testBridges() {
  AtomicBoolean closed = new AtomicBoolean();
  AtomicBoolean registered = new AtomicBoolean();
  ServiceImporter bridge = new ServiceImporter() {
    @Override
    public void start(Vertx vertx, ServicePublisher publisher, JsonObject configuration, Future<Void> future) {
      Record rec1 = HttpEndpoint.createRecord("static-record-1", "acme.org");
      Record rec2 = HttpEndpoint.createRecord("static-record-2", "example.com");
      publisher.publish(rec1,
        ar -> publisher.publish(rec2, ar2 -> {
          registered.set(true);
          future.complete();
        }));
    }

    @Override
    public void close(Handler<Void> closeHandler) {
      closed.set(true);
      closeHandler.handle(null);
    }
  };

  discovery.registerServiceImporter(bridge, null);

  await().untilAtomic(registered, is(true));

  AtomicReference<Record> record1 = new AtomicReference<>();
  AtomicReference<Record> record2 = new AtomicReference<>();
  discovery.getRecord(new JsonObject().put("name", "static-record-1"), found -> {
    record1.set(found.result());
  });

  discovery.getRecord(new JsonObject().put("name", "static-record-2"), found -> {
    record2.set(found.result());
  });


  assertThat(record1).isNotNull();
  assertThat(record2).isNotNull();

  discovery.close();

  await().untilAtomic(closed, is(true));
}
 
开发者ID:vert-x3,项目名称:vertx-service-discovery,代码行数:46,代码来源:DiscoveryImplTest.java

示例9: publishHttpEndpoint

import io.vertx.servicediscovery.types.HttpEndpoint; //导入方法依赖的package包/类
protected Future<Void> publishHttpEndpoint(String name, String host, int port) {
  Record record = HttpEndpoint.createRecord(name, host, port, "/",
    new JsonObject().put("api.name", config().getString("api.name", ""))
  );
  return publish(record);
}
 
开发者ID:sczyh30,项目名称:vertx-blueprint-microservice,代码行数:7,代码来源:BaseMicroserviceVerticle.java

示例10: publishHttpEndpoint

import io.vertx.servicediscovery.types.HttpEndpoint; //导入方法依赖的package包/类
protected Single<Void> publishHttpEndpoint(String name, String host, int port) {
  Record record = HttpEndpoint.createRecord(name, host, port, "/",
    new JsonObject().put("api.name", config().getString("api.name", ""))
  );
  return publish(record);
}
 
开发者ID:sczyh30,项目名称:vertx-blueprint-microservice,代码行数:7,代码来源:BaseMicroserviceRxVerticle.java

示例11: publishHttpEndpoint

import io.vertx.servicediscovery.types.HttpEndpoint; //导入方法依赖的package包/类
public void publishHttpEndpoint(String name, String host, int port, Handler<AsyncResult<Void>>
    completionHandler) {
  Record record = HttpEndpoint.createRecord(name, host, port, "/");
  publish(record, completionHandler);
}
 
开发者ID:cescoffier,项目名称:vertx-microservices-workshop,代码行数:6,代码来源:MicroServiceVerticle.java

示例12: publishHttpEndpoint

import io.vertx.servicediscovery.types.HttpEndpoint; //导入方法依赖的package包/类
protected Future<Record> publishHttpEndpoint(Integer port, boolean ssl) {

		String address = getAddress();

		RecordMetadata metadata = new RecordMetadata().setName(getAPIName()).setHealthPathCheck(options.getHealthPathCheck())
				.setHealthCheck(options.isHealthCheck());

		Record record = HttpEndpoint.createRecord(getAPIName(), ssl, address, port, ROOT, metadata.toJson());
		return publish(record);
	}
 
开发者ID:pflima92,项目名称:jspare-vertx-ms-blueprint,代码行数:11,代码来源:MicroserviceVerticle.java


注:本文中的io.vertx.servicediscovery.types.HttpEndpoint.createRecord方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。