當前位置: 首頁>>代碼示例>>Java>>正文


Java Future.succeeded方法代碼示例

本文整理匯總了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();
}
 
開發者ID:rhiot,項目名稱:hono-weather-demo,代碼行數:32,代碼來源:WeatherDataConsumer.java

示例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();
}
 
開發者ID:simonemasoni,項目名稱:vertx_spring,代碼行數:8,代碼來源:ServiceVerticle.java

示例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();
}
 
開發者ID:simonemasoni,項目名稱:vertx_spring,代碼行數:13,代碼來源:RestVerticle.java


注:本文中的io.vertx.core.Future.succeeded方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。