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


Java DeliveryOptions.setSendTimeout方法代碼示例

本文整理匯總了Java中io.vertx.core.eventbus.DeliveryOptions.setSendTimeout方法的典型用法代碼示例。如果您正苦於以下問題:Java DeliveryOptions.setSendTimeout方法的具體用法?Java DeliveryOptions.setSendTimeout怎麽用?Java DeliveryOptions.setSendTimeout使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.vertx.core.eventbus.DeliveryOptions的用法示例。


在下文中一共展示了DeliveryOptions.setSendTimeout方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: makeHandler

import io.vertx.core.eventbus.DeliveryOptions; //導入方法依賴的package包/類
private KafkaConsumerHandler makeHandler(final KafkaConsumerConfiguration configuration, final String vertxAddress) {
    return (message, futureResult) -> {
        final DeliveryOptions options = new DeliveryOptions();
        options.setSendTimeout(configuration.getEventBusSendTimeout());

        vertx.eventBus().send(vertxAddress, message, options, (result) -> {
            if (result.succeeded()) {
                futureResult.complete();
            } else {
                futureResult.fail(result.cause());
            }
        });
    };
}
 
開發者ID:hubrick,項目名稱:vertx-kafka-service,代碼行數:15,代碼來源:KafkaConsumerVerticle.java

示例2: process

import io.vertx.core.eventbus.DeliveryOptions; //導入方法依賴的package包/類
@Override
public boolean process(Exchange exchange, AsyncCallback callback) {
  Message in = exchange.getIn();

  Object body = CamelHelper.convert(inbound, in);

  DeliveryOptions delivery = CamelHelper.getDeliveryOptions(in, inbound.isHeadersCopy());
  if (inbound.getTimeout() > 0) {
    delivery.setSendTimeout(inbound.getTimeout());
  }

  try {
    if (inbound.isPublish()) {
      vertx.eventBus().publish(inbound.getAddress(), body, delivery);
    } else {
      if (ExchangeHelper.isOutCapable(exchange)) {
        vertx.eventBus().send(inbound.getAddress(), body, delivery, reply -> {
          Message out = exchange.getOut();
          if (reply.succeeded()) {
            out.setBody(reply.result().body());
            MultiMapHelper.toMap(reply.result().headers(), out.getHeaders());
          } else {
            exchange.setException(reply.cause());
          }
          // continue callback
          callback.done(false);
        });
        // being routed async so return false
        return false;
      } else {
        // No reply expected.
        vertx.eventBus().send(inbound.getAddress(), body, delivery);
      }
    }
  } catch (Throwable e) {
    // Mark the exchange as "failed".
    exchange.setException(e);
  }

  callback.done(true);
  return true;
}
 
開發者ID:vert-x3,項目名稱:vertx-camel-bridge,代碼行數:43,代碼來源:CamelToVertxProcessor.java


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