Ejemplo n.º 1
0
 /**
  * Like {@link io.vertx.golo.core.eventbus.EventBus#send} but specifying <code>options</code> that
  * can be used to configure the delivery.
  *
  * @param address the address to send it to
  * @param message the message, may be <code>null</code>
  * @param options delivery options (see <a
  *     href="../../../../../../../cheatsheet/DeliveryOptions.html">DeliveryOptions</a>)
  * @return a reference to this, so the API can be used fluently
  */
 public EventBus send(String address, Object message, Map<String, Object> options) {
   this.delegate.send(
       address,
       InternalHelper.unwrapObject(message),
       options != null
           ? new io.vertx.core.eventbus.DeliveryOptions(new io.vertx.core.json.JsonObject(options))
           : null);
   return this;
 }
Ejemplo n.º 2
0
 /**
  * Like {@link io.vertx.golo.core.eventbus.EventBus#send} but specifying a <code>replyHandler
  * </code> that will be called if the recipient subsequently replies to the message.
  *
  * @param address the address to send it to
  * @param message the message, may be <code>null</code>
  * @param replyHandler reply handler will be called when any reply from the recipient is received,
  *     may be <code>null</code>
  * @return a reference to this, so the API can be used fluently
  */
 public <T> EventBus send(
     String address, Object message, Handler<AsyncResult<Message<T>>> replyHandler) {
   this.delegate.send(
       address,
       InternalHelper.unwrapObject(message),
       new Handler<AsyncResult<io.vertx.core.eventbus.Message<java.lang.Object>>>() {
         public void handle(AsyncResult<io.vertx.core.eventbus.Message<java.lang.Object>> event) {
           AsyncResult<Message<Object>> f;
           if (event.succeeded()) {
             f = InternalHelper.<Message<Object>>result(new Message<Object>(event.result()));
           } else {
             f = InternalHelper.<Message<Object>>failure(event.cause());
           }
           replyHandler.handle((AsyncResult) f);
         }
       });
   return this;
 }
Ejemplo n.º 3
0
 /**
  * Sends a message.
  *
  * <p>The message will be delivered to at most one of the handlers registered to the address.
  *
  * @param address the address to send it to
  * @param message the message, may be <code>null</code>
  * @return a reference to this, so the API can be used fluently
  */
 public EventBus send(String address, Object message) {
   this.delegate.send(address, InternalHelper.unwrapObject(message));
   return this;
 }