Hey Jungtaek! Wanted to update the mailing list on my current approach in case others wanted something similar. I created an asynchronous poller iterates though all active queries and checks of the isTriggering boolean value is true. Here’s an example code snippet: ```java public static void checkAndUpdateSubscribers(SparkSession sparkSession) { StreamingQuery[] activeQueries = sparkSession.streams().active(); boolean anyTriggering = false; for (StreamingQuery query : activeQueries) { if (query.isActive() && query.recentProgress().length > 0) { boolean isTriggering = query.lastProgress() != null && query.lastProgress().numInputRows() > 0; if (isTriggering) { anyTriggering = true; break; } } } notifySubscribers(anyTriggering); } private static void notifySubscribers(boolean isTriggering) { Iterator<WeakReference<Consumer<Boolean>>> iterator = subscribers.iterator(); while (iterator.hasNext()) { WeakReference<Consumer<Boolean>> weakRef = iterator.next(); Consumer<Boolean> consumer = weakRef.get(); if (consumer != null) { consumer.accept(isTriggering); } else { iterator.remove(); } } } ``` I have yet to look at QueryListener’s implementation but people i’ll take a stab at it. Regards, Jevon C On Mar 27, 2025, at 6:04 PM, Jungtaek Lim <kabhwan.opensou...@gmail.com> wrote:
|
- Inquiry in regards to a New onQuery Method for StreamingQuery... Jevon Cowell
- Re: Inquiry in regards to a New onQuery Method for Strea... Jungtaek Lim
- Re: Inquiry in regards to a New onQuery Method for S... Jevon Cowell
- Re: Inquiry in regards to a New onQuery Method f... Jevon Cowell