@Test public void testObserverToHandler() throws Exception { AtomicInteger count = new AtomicInteger(); Observer<Long> observer = new Observer<Long>() { @Override public void onCompleted() { assertEquals(1, count.get()); testComplete(); } @Override public void onError(Throwable e) { fail(e.getMessage()); } @Override public void onNext(Long l) { count.incrementAndGet(); } }; vertx.setTimer(1, RxHelper.toHandler(observer)); await(); }
@Override public void start() throws Exception { if (config.isRefetchImmediatelyOnDeliveryWithMaxAmountOfNodes()) { this.subscriber = new BaseSubscriber<ConfirmedDeliveryEvent>() { @Override protected void hookOnNext(ConfirmedDeliveryEvent event) { try { onConfirmedDeliveryPackage(event); } catch (Exception e) { log.error("", e); } } }; xfcdEvents.subscribe(ConfirmedDeliveryEvent.class, this.subscriber); } this.initTimerId = vertx.setTimer(config.getInitialDelayInMs(), timerId -> { fetchDeliveriesAndPublishOnEventBus(); this.periodicTimerId = vertx.setPeriodic(config.getIntervalInMs(), foo -> { fetchDeliveriesAndPublishOnEventBus(); }); }); }