本文整理匯總了Java中io.vertx.core.Future.succeeded方法的典型用法代碼示例。如果您正苦於以下問題:Java Future.succeeded方法的具體用法?Java Future.succeeded怎麽用?Java Future.succeeded使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類io.vertx.core.Future
的用法示例。
在下文中一共展示了Future.succeeded方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: consumeWeatherData
import io.vertx.core.Future; //導入方法依賴的package包/類
/**
* consumeWeatherData connects the WeatherDataConsumer to the hono server to read from TENANT_ID.
* @throws Exception N/A
*/
private void consumeWeatherData() throws Exception {
final Future<MessageConsumer> consumerFuture = Future.future();
consumerFuture.setHandler(result -> {
if (!result.succeeded()) {
System.err.println("honoClient could not create telemetry consumer : " + result.cause());
}
latch.countDown();
});
final Future<HonoClient> connectionTracker = Future.future();
honoClient.connect(new ProtonClientOptions(), connectionTracker.completer());
connectionTracker.compose(honoClient -> {
honoClient.createTelemetryConsumer(TENANT_ID,
msg -> handleWeatherMessage(msg), consumerFuture.completer());
},
consumerFuture);
latch.await();
//If consumer connects, then reads information.
if (consumerFuture.succeeded())
System.in.read();
//Closes AMQP connection with hono server.
vertx.close();
}
示例2: start
import io.vertx.core.Future; //導入方法依賴的package包/類
@Override
public void start(Future<Void> startFuture) throws Exception {
for (ServiceHandler serviceHandler : serviceHandlers) {
vertx.eventBus().consumer(serviceHandler.getPath(), handler(serviceHandler));
}
startFuture.succeeded();
}
示例3: start
import io.vertx.core.Future; //導入方法依賴的package包/類
@Override
public void start(Future<Void> startFuture) throws Exception {
Router router = Router.router(vertx);
configureRoutes(router);
final Integer serverPort = context.config().getInteger("server.port", 8765);
logger.info("Starting http server on port {}", serverPort);
vertx.createHttpServer().requestHandler(router::accept).listen(serverPort);
startFuture.succeeded();
}