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


Java EventBusService.createRecord方法代码示例

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


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

示例1: testLookupWithNonMatchingQuery

import io.vertx.servicediscovery.types.EventBusService; //导入方法依赖的package包/类
@Test
public void testLookupWithNonMatchingQuery() throws UnsupportedEncodingException {
  HelloService svc = new HelloServiceImpl("stuff");
  ProxyHelper.registerService(HelloService.class, vertx, svc, "address");

  Record record1 = EventBusService.createRecord("Hello", "address", HelloService.class,
    new JsonObject().put("key", "foo"));
  Record record2 = EventBusService.createRecord("Hello-2", "address", HelloService.class,
    new JsonObject().put("key", "bar"));

  discovery.publish(record1, (r) -> {
  });
  discovery.publish(record2, (r) -> {
  });

  await().until(() -> record1.getRegistration() != null);
  await().until(() -> record2.getRegistration() != null);

  JsonArray services = given()
    .param("query", "{\"stuff\":\"*\"}")
    .get("/discovery")
    .asJsonArray();

  assertThat(services.size()).isEqualTo(0);
}
 
开发者ID:vert-x3,项目名称:vertx-service-discovery,代码行数:26,代码来源:ServiceDiscoveryRestEndpointTest.java

示例2: example1

import io.vertx.servicediscovery.types.EventBusService; //导入方法依赖的package包/类
public void example1(ServiceDiscovery discovery) {
  Record record = EventBusService.createRecord(
      "some-eventbus-service", // The service name
      "address", // the service address,
      MyService.class // the service interface
  );

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

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

示例3: example1

import io.vertx.servicediscovery.types.EventBusService; //导入方法依赖的package包/类
public void example1(ServiceDiscovery discovery) {
  Record record = EventBusService.createRecord(
      "some-eventbus-service", // The service name
      "address", // the service address,
      "examples.MyService", // the service interface as string
      new JsonObject()
          .put("some-metadata", "some value")
  );

  discovery.publish(record, ar -> {
    // ...
  });
}
 
开发者ID:vert-x3,项目名称:vertx-service-discovery,代码行数:14,代码来源:EventBusServiceExamples.java

示例4: testThatWeGetTheTwoPublishedServicesWithMetadata

import io.vertx.servicediscovery.types.EventBusService; //导入方法依赖的package包/类
@Test
public void testThatWeGetTheTwoPublishedServicesWithMetadata() {
  HelloService svc = new HelloServiceImpl("stuff");
  ProxyHelper.registerService(HelloService.class, vertx, svc, "address");

  Record record1 = EventBusService.createRecord("Hello", "address", HelloService.class,
    new JsonObject().put("key", "foo"));
  Record record2 = EventBusService.createRecord("Hello-2", "address", HelloService.class,
    new JsonObject().put("key", "bar"));

  discovery.publish(record1, (r) -> {
  });
  discovery.publish(record2, (r) -> {
  });

  await().until(() -> record1.getRegistration() != null);
  await().until(() -> record2.getRegistration() != null);

  Restafari.Response response = get("/discovery");
  JsonArray services = new JsonArray(response.asString());

  assertThat(services.size()).isEqualTo(2);

  for (Object json : services) {
    Record rec = new Record((JsonObject) json);
    assertThat(rec.getStatus()).isEqualTo(Status.UP);
    assertThat(rec.getRegistration()).isNotNull();
    assertThat(rec.getName()).startsWith("Hello");
    assertThat(rec.getMetadata().getString("key")).isNotNull();

    get("/discovery/" + rec.getRegistration()).then().body("name", not(nullValue()));
  }
}
 
开发者ID:vert-x3,项目名称:vertx-service-discovery,代码行数:34,代码来源:ServiceDiscoveryRestEndpointTest.java

示例5: testLookupWithQuery

import io.vertx.servicediscovery.types.EventBusService; //导入方法依赖的package包/类
@Test
public void testLookupWithQuery() throws UnsupportedEncodingException {
  HelloService svc = new HelloServiceImpl("stuff");
  ProxyHelper.registerService(HelloService.class, vertx, svc, "address");

  Record record1 = EventBusService.createRecord("Hello", "address", HelloService.class,
    new JsonObject().put("key", "foo"));
  Record record2 = EventBusService.createRecord("Hello-2", "address", HelloService.class,
    new JsonObject().put("key", "bar"));

  discovery.publish(record1, (r) -> {
  });
  discovery.publish(record2, (r) -> {
  });

  await().until(() -> record1.getRegistration() != null);
  await().until(() -> record2.getRegistration() != null);


  JsonArray services =
    given()
      .param("query", "{\"name\":\"Hello\"}")
      .get("/discovery")
      .asJsonArray();

  assertThat(services.size()).isEqualTo(1);
}
 
开发者ID:vert-x3,项目名称:vertx-service-discovery,代码行数:28,代码来源:ServiceDiscoveryRestEndpointTest.java

示例6: createEventBusRecord

import io.vertx.servicediscovery.types.EventBusService; //导入方法依赖的package包/类
private Record createEventBusRecord(EventBusServiceConfiguration configuration) {
    return EventBusService.createRecord(configuration.getName(),
            configuration.getAddress(),
            configuration.getServiceClass(),
            configuration.getMetadata());
}
 
开发者ID:GwtDomino,项目名称:domino,代码行数:7,代码来源:EventBusServiceDiscovery.java

示例7: publishEventBusServiceEndpoint

import io.vertx.servicediscovery.types.EventBusService; //导入方法依赖的package包/类
protected Future<Record> publishEventBusServiceEndpoint(String name, String address, Class<?> serviceClass) {
	Record record = EventBusService.createRecord(name, address, serviceClass);
	return publish(record);
}
 
开发者ID:pflima92,项目名称:jspare-vertx-ms-blueprint,代码行数:5,代码来源:MicroserviceVerticle.java

示例8: publishEventBusService

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

示例9: publishEventBusService

import io.vertx.servicediscovery.types.EventBusService; //导入方法依赖的package包/类
protected Future<Void> publishEventBusService(String name, String address, Class serviceClass) {
  Record record = EventBusService.createRecord(name, address, serviceClass);
  return publish(record);
}
 
开发者ID:sczyh30,项目名称:vertx-blueprint-microservice,代码行数:5,代码来源:BaseMicroserviceVerticle.java

示例10: publishEventBusService

import io.vertx.servicediscovery.types.EventBusService; //导入方法依赖的package包/类
protected Single<Void> publishEventBusService(String name, String address, Class serviceClass) {
  Record record = EventBusService.createRecord(name, address, serviceClass);
  return publish(record);
}
 
开发者ID:sczyh30,项目名称:vertx-blueprint-microservice,代码行数:5,代码来源:BaseMicroserviceRxVerticle.java

示例11: publishEventBusService

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


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