@Override
  public InputRow nextRow() {
    InputRow next = firehose.nextRow();

    if (!beginRejectionPolicy || rejectionPolicy.accept(next.getTimestampFromEpoch())) {
      return next;
    }

    return null;
  }
Ejemplo n.º 2
0
  @Test
  public void errorTest() throws InterruptedException {
    AVar<Throwable> caught = new AVar<>();
    Dispatcher asyncDispatcher = new ThreadPoolExecutorDispatcher(2, 100);
    Firehose<Key, Integer> asyncFirehose =
        new Firehose<>(asyncDispatcher, consumerRegistry, null, throwable -> caught.set(throwable));
    Key k1 = Key.wrap("key1");

    asyncFirehose.on(
        k1,
        (i) -> {
          int j = i / 0;
        });

    asyncFirehose.notify(k1, 1);

    assertTrue(caught.get(1, TimeUnit.MINUTES) instanceof ArithmeticException);

    asyncDispatcher.shutdown();
  }
 @Override
 public void close() throws IOException {
   firehose.close();
 }
 @Override
 public Runnable commit() {
   return firehose.commit();
 }
 @Override
 public boolean hasMore() {
   return valveOn.get() && firehose.hasMore();
 }