Java Code Examples for io.vertx.reactivex.core.Vertx#eventBus()

The following examples show how to use io.vertx.reactivex.core.Vertx#eventBus() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RxifiedExamples.java    From vertx-rx with Apache License 2.0 5 votes vote down vote up
public void eventBusMessages(Vertx vertx) {
  EventBus eb = vertx.eventBus();
  MessageConsumer<String> consumer = eb.<String>consumer("the-address");
  Observable<Message<String>> observable = consumer.toObservable();
  Disposable sub = observable.subscribe(msg -> {
    // Got message
  });

  // Unregisters the stream after 10 seconds
  vertx.setTimer(10000, id -> {
    sub.dispose();
  });
}
 
Example 2
Source File: RxifiedExamples.java    From vertx-rx with Apache License 2.0 4 votes vote down vote up
public void eventBusBodies(Vertx vertx) {
  EventBus eb = vertx.eventBus();
  MessageConsumer<String> consumer = eb.<String>consumer("the-address");
  Observable<String> observable = consumer.bodyStream().toObservable();
}