本文整理了Java中io.vertx.servicediscovery.Record.toJson
方法的一些代码示例,展示了Record.toJson
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Record.toJson
方法的具体详情如下:
包路径:io.vertx.servicediscovery.Record
类名称:Record
方法名:toJson
暂无
代码示例来源:origin: engagingspaces/vertx-graphql-service-discovery
/**
* @return the JSON representation of the current
* {@link SchemaReferenceData}.
*/
public JsonObject toJson() {
return new JsonObject()
.put("id", id)
.put("record", record.toJson())
.put("type", Status.RELEASED.equals(status) ? "release" : "bind");
}
代码示例来源:origin: io.vertx/vertx-service-discovery
private void sendBindEvent(ServiceReference reference) {
if (usage == null) {
return;
}
vertx.eventBus().publish(usage, new JsonObject()
.put("type", "bind")
.put("record", reference.record().toJson())
.put("id", id));
}
代码示例来源:origin: vert-x3/vertx-service-discovery
private void sendBindEvent(ServiceReference reference) {
if (usage == null) {
return;
}
vertx.eventBus().publish(usage, new JsonObject()
.put("type", "bind")
.put("record", reference.record().toJson())
.put("id", id));
}
代码示例来源:origin: io.vertx/vertx-service-discovery
private void sendUnbindEvent(ServiceReference reference) {
if (usage == null) {
return;
}
vertx.eventBus().publish(usage, new JsonObject()
.put("type", "release")
.put("record", reference.record().toJson())
.put("id", id));
}
代码示例来源:origin: io.vertx/vertx-service-discovery-backend-redis
@Override
public void update(Record record, Handler<AsyncResult<Void>> resultHandler) {
Objects.requireNonNull(record.getRegistration(), "No registration id in the record");
redis.hset(key, record.getRegistration(), record.toJson().encode(), ar -> {
if (ar.succeeded()) {
resultHandler.handle(Future.succeededFuture());
} else {
resultHandler.handle(Future.failedFuture(ar.cause()));
}
});
}
代码示例来源:origin: vert-x3/vertx-service-discovery
private void sendUnbindEvent(ServiceReference reference) {
if (usage == null) {
return;
}
vertx.eventBus().publish(usage, new JsonObject()
.put("type", "release")
.put("record", reference.record().toJson())
.put("id", id));
}
代码示例来源:origin: vert-x3/vertx-service-discovery
private void unpublishRecord(Record record, Handler<Void> completionHandler) {
publisher.unpublish(record.getRegistration(), ar -> {
if (ar.failed()) {
LOGGER.error("Cannot unregister kubernetes service", ar.cause());
} else {
LOGGER.info("Kubernetes service unregistered from the vert.x registry: " + record.toJson());
if (completionHandler != null) {
completionHandler.handle(null);
}
}
});
}
代码示例来源:origin: io.vertx/vertx-lang-groovy
public static java.util.Map<String, Object> createRecord(io.vertx.servicediscovery.types.MessageSource j_receiver, java.lang.String name, java.lang.String address, java.lang.String type) {
return io.vertx.servicediscovery.types.MessageSource.createRecord(name,
address,
type) != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(io.vertx.servicediscovery.types.MessageSource.createRecord(name,
address,
type).toJson()) : null;
}
public static java.util.Map<String, Object> createRecord(io.vertx.servicediscovery.types.MessageSource j_receiver, java.lang.String name, java.lang.String address) {
代码示例来源:origin: io.vertx/vertx-lang-groovy
public static java.util.Map<String, Object> createRecord(io.vertx.servicediscovery.types.EventBusService j_receiver, java.lang.String name, java.lang.String address, java.lang.String classname) {
return io.vertx.servicediscovery.types.EventBusService.createRecord(name,
address,
classname) != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(io.vertx.servicediscovery.types.EventBusService.createRecord(name,
address,
classname).toJson()) : null;
}
}
代码示例来源:origin: io.vertx/vertx-lang-groovy
public static java.util.Map<String, Object> createRecord(io.vertx.servicediscovery.types.HttpEndpoint j_receiver, java.lang.String name, java.lang.String host, int port, java.lang.String root) {
return io.vertx.servicediscovery.types.HttpEndpoint.createRecord(name,
host,
port,
root) != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(io.vertx.servicediscovery.types.HttpEndpoint.createRecord(name,
host,
port,
root).toJson()) : null;
}
public static java.util.Map<String, Object> createRecord(io.vertx.servicediscovery.types.HttpEndpoint j_receiver, java.lang.String name, java.lang.String host) {
代码示例来源:origin: io.vertx/vertx-lang-groovy
public static java.util.Map<String, Object> createRecord(io.vertx.servicediscovery.types.HttpEndpoint j_receiver, java.lang.String name, java.lang.String host) {
return io.vertx.servicediscovery.types.HttpEndpoint.createRecord(name,
host) != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(io.vertx.servicediscovery.types.HttpEndpoint.createRecord(name,
host).toJson()) : null;
}
public static void getClient(io.vertx.servicediscovery.types.HttpEndpoint j_receiver, io.vertx.servicediscovery.ServiceDiscovery discovery, java.util.Map<String, Object> filter, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.core.http.HttpClient>> resultHandler) {
代码示例来源:origin: io.vertx/vertx-lang-groovy
public static java.util.Map<String, Object> createRecord(io.vertx.servicediscovery.types.MessageSource j_receiver, java.lang.String name, java.lang.String address) {
return io.vertx.servicediscovery.types.MessageSource.createRecord(name,
address) != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(io.vertx.servicediscovery.types.MessageSource.createRecord(name,
address).toJson()) : null;
}
public static <T>void getConsumer(io.vertx.servicediscovery.types.MessageSource j_receiver, io.vertx.servicediscovery.ServiceDiscovery discovery, java.util.Map<String, Object> filter, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.core.eventbus.MessageConsumer<java.lang.Object>>> resultHandler) {
代码示例来源:origin: io.vertx/vertx-lang-groovy
public static java.util.Map<String, Object> createRecord(io.vertx.servicediscovery.types.EventBusService j_receiver, java.lang.String name, java.lang.String address, java.lang.String itf, java.util.Map<String, Object> metadata) {
return io.vertx.servicediscovery.types.EventBusService.createRecord(name,
address,
itf,
metadata != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(metadata) : null) != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(io.vertx.servicediscovery.types.EventBusService.createRecord(name,
address,
itf,
metadata != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(metadata) : null).toJson()) : null;
}
public static <T>java.lang.Object getServiceProxy(io.vertx.servicediscovery.types.EventBusService j_receiver, io.vertx.servicediscovery.ServiceDiscovery discovery, java.util.function.Function<java.util.Map<String, Object>, java.lang.Boolean> filter, java.lang.Class<java.lang.Object> clientClass, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Object>> resultHandler) {
代码示例来源:origin: io.vertx/vertx-lang-groovy
public static java.util.Map<String, Object> createRecord(io.vertx.servicediscovery.types.HttpEndpoint j_receiver, java.lang.String name, java.lang.String host, int port, java.lang.String root, java.util.Map<String, Object> metadata) {
return io.vertx.servicediscovery.types.HttpEndpoint.createRecord(name,
host,
port,
root,
metadata != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(metadata) : null) != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(io.vertx.servicediscovery.types.HttpEndpoint.createRecord(name,
host,
port,
root,
metadata != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(metadata) : null).toJson()) : null;
}
public static java.util.Map<String, Object> createRecord(io.vertx.servicediscovery.types.HttpEndpoint j_receiver, java.lang.String name, boolean ssl, java.lang.String host, int port, java.lang.String root, java.util.Map<String, Object> metadata) {
代码示例来源:origin: io.vertx/vertx-lang-groovy
public static java.util.Map<String, Object> createRecord(io.vertx.servicediscovery.types.MessageSource j_receiver, java.lang.String name, java.lang.String address, java.lang.String type, java.util.Map<String, Object> metadata) {
return io.vertx.servicediscovery.types.MessageSource.createRecord(name,
address,
type,
metadata != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(metadata) : null) != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(io.vertx.servicediscovery.types.MessageSource.createRecord(name,
address,
type,
metadata != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(metadata) : null).toJson()) : null;
}
public static java.util.Map<String, Object> createRecord(io.vertx.servicediscovery.types.MessageSource j_receiver, java.lang.String name, java.lang.String address, java.lang.String type) {
代码示例来源:origin: io.vertx/vertx-lang-groovy
public static java.util.Map<String, Object> createRecord(io.vertx.servicediscovery.types.RedisDataSource j_receiver, java.lang.String name, java.util.Map<String, Object> location, java.util.Map<String, Object> metadata) {
return io.vertx.servicediscovery.types.RedisDataSource.createRecord(name,
location != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(location) : null,
metadata != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(metadata) : null) != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(io.vertx.servicediscovery.types.RedisDataSource.createRecord(name,
location != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(location) : null,
metadata != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(metadata) : null).toJson()) : null;
}
public static void getRedisClient(io.vertx.servicediscovery.types.RedisDataSource j_receiver, io.vertx.servicediscovery.ServiceDiscovery discovery, java.util.Map<String, Object> filter, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.redis.RedisClient>> resultHandler) {
代码示例来源:origin: io.vertx/vertx-lang-groovy
public static java.util.Map<String, Object> createRecord(io.vertx.servicediscovery.types.JDBCDataSource j_receiver, java.lang.String name, java.util.Map<String, Object> location, java.util.Map<String, Object> metadata) {
return io.vertx.servicediscovery.types.JDBCDataSource.createRecord(name,
location != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(location) : null,
metadata != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(metadata) : null) != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(io.vertx.servicediscovery.types.JDBCDataSource.createRecord(name,
location != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(location) : null,
metadata != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(metadata) : null).toJson()) : null;
}
public static void getJDBCClient(io.vertx.servicediscovery.types.JDBCDataSource j_receiver, io.vertx.servicediscovery.ServiceDiscovery discovery, java.util.Map<String, Object> filter, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.ext.jdbc.JDBCClient>> resultHandler) {
代码示例来源:origin: io.vertx/vertx-lang-groovy
public static java.util.Map<String, Object> createRecord(io.vertx.servicediscovery.types.MongoDataSource j_receiver, java.lang.String name, java.util.Map<String, Object> location, java.util.Map<String, Object> metadata) {
return io.vertx.servicediscovery.types.MongoDataSource.createRecord(name,
location != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(location) : null,
metadata != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(metadata) : null) != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(io.vertx.servicediscovery.types.MongoDataSource.createRecord(name,
location != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(location) : null,
metadata != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(metadata) : null).toJson()) : null;
}
public static void getMongoClient(io.vertx.servicediscovery.types.MongoDataSource j_receiver, io.vertx.servicediscovery.ServiceDiscovery discovery, java.util.Map<String, Object> filter, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.ext.mongo.MongoClient>> resultHandler) {
代码示例来源:origin: io.vertx/vertx-service-discovery
@Test
public void testFailedPublication() {
HelloService svc = new HelloServiceImpl("stuff");
ProxyHelper.registerService(HelloService.class, vertx, svc, "address");
Record record = new Record()
.setName("Hello")
.setRegistration("this-is-not-allowed")
.setLocation(new JsonObject().put(Record.ENDPOINT, "address"));
Restafari.Response response = given().request().body(record.toJson().toString()).post("/discovery");
assertThat(response.getStatusCode()).isEqualTo(500);
}
代码示例来源:origin: vert-x3/vertx-service-discovery
@Test
public void testFailedPublication() {
HelloService svc = new HelloServiceImpl("stuff");
ProxyHelper.registerService(HelloService.class, vertx, svc, "address");
Record record = new Record()
.setName("Hello")
.setRegistration("this-is-not-allowed")
.setLocation(new JsonObject().put(Record.ENDPOINT, "address"));
Restafari.Response response = given().request().body(record.toJson().toString()).post("/discovery");
assertThat(response.getStatusCode()).isEqualTo(500);
}
内容来源于网络,如有侵权,请联系作者删除!