io.vertx.up.unity.Web Maven / Gradle / Ivy
package io.vertx.up.unity;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
import io.vertx.core.eventbus.Message;
import io.vertx.core.json.JsonObject;
import io.vertx.up.commune.Envelop;
class Web {
static Handler> toHandler(
final Message message
) {
return handler -> {
if (handler.succeeded()) {
message.reply(To.toEnvelop(handler.result()));
} else {
// Readible codec for configured information, error flow needed.
if (null != handler.cause()) {
handler.cause().printStackTrace();
}
message.reply(Envelop.failure(To.toError(Web.class, handler.cause())));
}
};
}
static Handler> toHandler(
final Message message,
final JsonObject data
) {
return handler -> {
if (handler.succeeded() && handler.result()) {
message.reply(To.toEnvelop(data));
} else {
message.reply(To.toEnvelop(Boolean.FALSE));
}
};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy