@Test public void on() throws InterruptedException { AtomicInteger triggers = new AtomicInteger(); WebsocketProcessorEventsSource testSubject = new WebsocketProcessorEventsSource(() -> { triggers.incrementAndGet(); }); ScheduledFuture<?> scheduler = Executors.newSingleThreadScheduledExecutor() .scheduleAtFixedRate(testSubject::applyIfUpdates, 10, 10, TimeUnit.MILLISECONDS); testSubject.on(new EventProcessorEvents.EventProcessorStatusUpdate(null)); testSubject.on(new EventProcessorEvents.EventProcessorStatusUpdate(null)); testSubject.on(new EventProcessorEvents.EventProcessorStatusUpdate(null)); testSubject.on(new EventProcessorEvents.EventProcessorStatusUpdate(null)); testSubject.on(new EventProcessorEvents.EventProcessorStatusUpdate(null)); Thread.sleep(20); assertEquals(1, triggers.get()); testSubject.on(new EventProcessorEvents.EventProcessorStatusUpdate(null)); Thread.sleep(15); assertEquals(2, triggers.get()); scheduler.cancel(false); }
@EventListener public void on(EventProcessorStatusUpdate event) { updates.set(true); }
WebsocketProcessorEventsSource { @EventListener public void on(EventProcessorStatusUpdate event) { updates.set(true); } }
WebsocketProcessorEventsSource { @EventListener public void on(EventProcessorStatusUpdate event) { updates.set(true); } @Autowired  WebsocketProcessorEventsSource(SimpMessagingTemplate websocket);  WebsocketProcessorEventsSource(Runnable updatesConsumer); }
WebsocketProcessorEventsSource { @EventListener public void on(EventProcessorStatusUpdate event) { updates.set(true); } @Autowired  WebsocketProcessorEventsSource(SimpMessagingTemplate websocket);  WebsocketProcessorEventsSource(Runnable updatesConsumer); @Scheduled(initialDelayString = "${axoniq.axonserver.websocket-update.initial-delay:10000}", fixedRateString = "${axoniq.axonserver.websocket-update.rate:1000}") void applyIfUpdates(); @EventListener void on(EventProcessorStatusUpdate event); }
WebsocketProcessorEventsSource { @EventListener public void on(EventProcessorStatusUpdate event) { updates.set(true); } @Autowired  WebsocketProcessorEventsSource(SimpMessagingTemplate websocket);  WebsocketProcessorEventsSource(Runnable updatesConsumer); @Scheduled(initialDelayString = "${axoniq.axonserver.websocket-update.initial-delay:10000}", fixedRateString = "${axoniq.axonserver.websocket-update.rate:1000}") void applyIfUpdates(); @EventListener void on(EventProcessorStatusUpdate event);  }