@Override
public void run() {
Flux<String> ultimateSource = Flux.fromStream(br.lines());
Subscriber<Runnable> guiSystem = new ConsumerSubscriber<Runnable>(
x -> runLater(x),
x -> whenDone.accept(x),
() -> whenDone.accept(null)
);
ultimateSource.map(this::stringsToUpdates).subscribeWith(guiSystem);
}
this is a minimum interesting example, I think, because I am taking a BufferedReader and putting it through the (very stateful) stringsToUpdates() function
which returns Runnables which get runLater() in the "JavaFX Application Thread". The ConsumerSubscriber also routes completion and errors to a
Consumer<Throwable> which ties up any loose ends at the end in the GUI and otherwise, I want these running in some thread that is not the "Java FX
Application Thread" but otherwise I am not that picky.
It seems to work but I want to check that it is making sense.
Some more things:
(1) How do I go the whole way and pipe GUI events in context through the framework
(2) So long as GUI updates commute, which they will most of the time, the system will operate predictably, but I could imagine situations where they don't. Non-commutative operators such as .clear() will be sometimes necessary however, and I am wondering how to set up a "barrier" of some kind to manage this.