title: Terminate and get results from an event bus
body: <p>Let's say I've got two verticles that are discovering special file names (for example. could be anything though) and publishing them to <strong>event bus</strong> e.g. one is reading names from a REST api and another from a filesystem:</p>
  
  <p><em>ScanRestVerticle.java</em></p>
  
  <pre><code>/**
   * Reads file names through an REST API
   */
  public class ScanRestVerticle extends AbstractVerticle {
  
      @Override
      public void start() throws Exception {
          HttpClientRequest req = vertx.createHttpClient().request(HttpMethod.GET, "BASE_URL", "URL");
  
          req.toObservable()
             .flatMap(HttpClientResponse::toObservable)
             .lift(unmarshaller(Model.class))
             .subscribe(c -&gt; vertx.eventBus().publish("address", c.specialName()));
          req.exceptionHandler(Throwable::printStackTrace);
          req.end();
      }
  }
  </code></pre>
  
  <p><em>ScanFsVerticle.java</em></p>
  
  <pre><code>/**
   * Reads file names from a file
   */
  public class ScanFsVerticle.java extends AbstractVerticle {
  
      @Override
      public void start() throws Exception {
          StringObservable.byLine(vertx.fileSystem()
              .rxReadFile("myFileNames.txt")
              .map(Buffer::toString)
              .toObservable())
              .subscribe(c -&gt; vertx.eventBus().publish("address", c), e -&gt; System.err.println(e.getMessage()));
      }
  }
  </code></pre>
  
  <p>Everything works great here, but, now, I have an verticle which is combining these names from an event bus and print them on STD.OUT:</p>
  
  <p><em>PrintVerticle.java</em></p>
  
  <pre><code>public class PrintVerticle extends AbstractVerticle {
  
      @Override
      public void start() throws Exception {
          vertx.eventBus()
              .&lt;JsonObject&gt;consumer("address")
              .bodyStream()
              .toObservable()
              .reduce(new JsonArray(), JsonArray::add)
              .subscribe(j -&gt; System.out.println(j.toString()));
  }
  </code></pre>
  
  <p>The problem is that <strong>reduce</strong> here is never actually completed, because event bus is making an infinite stream as I think.</p>
  
  <p>So how do I actually complete this operation and print the names published by both verticles?</p>
  
  <p><em>Note:</em> I'm really new in vert.x and rx and I might missing some pieces or get something wrong, so please dont' judge :)</p>
  
  <p>Thanks in advance.</p>
  
  <p>EDIT: I could call <code>scan()</code> instead of <code>reduce()</code> here, to get intermediate results, but how would I get <code>scan().last()</code>?</p>