本文整理汇总了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);
}
示例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 -> {
// ...
});
}
示例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 -> {
// ...
});
}
示例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()));
}
}
示例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);
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}