DNA//evolutions
JOpt.TourOptimizer · Feature Spotlight

Reactive Events.
Every signal, in real time,
composable by design.

The event system is not an add-on. It is the native execution model.

Most optimization engines are batch systems. You send input, wait, and receive output. What happens during the run is a black box. If the run takes 20 minutes, you stare at a blank screen for 20 minutes.

JOpt.TourOptimizer is built on a reactive, stream-based architecture. Every signal the optimizer produces (progress, warnings, errors, status changes, node filtering events, intermediate results) is emitted through RxJava ReplaySubjects. You subscribe to the events you need, process them without blocking the optimizer, and compose them into your application's event-driven infrastructure.

Nine typed event streams. Composable with the full RxJava operator library. Native integration with Spring WebFlux. This is not logging. This is a reactive pipeline.

9 streams
Typed event subjects
RxJava 3
ReplaySubjects with bounded buffers
WebFlux
Native reactive service integration
Optimization is not a batch job anymore.

Modern applications need continuous visibility into long-running processes. Dispatchers want live progress bars. Service APIs need streaming status endpoints. Monitoring systems require structured telemetry. And when something goes wrong, the error must propagate deterministically through your application's error handling chain, not get swallowed in a background thread.

Traditional optimization engines were designed for a simpler world: synchronous call, blocking wait, result returned. Observability was an afterthought. Error handling inside the solver was opaque. Integrating into reactive service architectures (Spring WebFlux, event-driven microservices, real-time dashboards) required awkward polling or custom wrappers.

JOpt was designed for the reactive world from the start. The same event pipeline that drives internal optimization phases is exposed to the integrator.

“The reactive event architecture maps directly onto Spring WebFlux and other reactive frameworks. Because JOpt emits events through RxJava subjects, they can be bridged to Project Reactor with minimal wiring.”

JOpt.TourOptimizer System Architecture
Nine event streams.
One composable pipeline.

Every optimization event is emitted through typed RxJava 3 ReplaySubjects with bounded buffers. Progress, status, warnings, errors, node filtering, intermediate results, before/after filtering snapshots. Late subscribers receive buffered recent events. All subjects complete automatically when the optimization finishes.

Subscribe to any combination of streams independently. Multiple subscribers can attach to the same subject. A logging subscriber and a metrics subscriber both receive every event without interference.

Progress frequency is controllable per algorithm stage. The simulated annealing phase can emit every 0.1%, the genetic phase every 0.01%. On-demand progress requests are supported for external polling patterns.

Legacy callback methods (onProgress, onError, onWarning) are internally backed by subscriptions to the same ReplaySubjects. Callbacks and direct subject subscriptions coexist safely. There is one event source, multiple consumption patterns.

What batch engines miss

Without reactive events, you get three options: block and wait, poll a status endpoint, or parse log files. None of these provide real-time, structured, composable event data. You cannot combine progress with intermediate results for stage-aware validation. You cannot route error events into your application's exception handling chain. You cannot stream live updates to a WebSocket without building a custom bridge.

Deterministic error propagation

Exceptions in optimizer threads propagate through custom UncaughtExceptionHandlers into the CompletableFuture result. Exceptions in subscriber lambdas are captured by RxJava error consumers and routed into the same policy. No silent failures. No orphaned threads. Clean shutdown paths in every scenario.

The key difference

JOpt's event system is not a logging layer. It is the native execution model. Internal optimization phases emit through the same subjects that external integrators subscribe to. The reactive pipeline is the architecture, not a wrapper around it.

Batch optimization enginesJOpt reactive architecture
× Block and wait for result Subscribe to live event streams
× Opaque error handling Deterministic exception propagation
× No intermediate results Intermediate + before/after snapshots
× Polling for progress Push-based, frequency-controlled
× Custom wrappers for reactive Native RxJava 3 / WebFlux integration

Composable with RxJava operators

Combine results with progress using withLatestFrom for stage-aware validation. Filter subjects with predicates to create stage-specific dashboards. Attach TestObservers for integration testing directly on event streams. The full RxJava operator library is available on every subject.

Spring WebFlux ready

The TourOptimizer REST service is packaged as a Spring WebFlux application. RxJava subjects bridge to Reactor Flux for Server-Sent Events and WebSocket progress streaming. Non-blocking job control through CompletableFuture. Multiple concurrent optimizations, each with its own event stream. No thread starvation under load.

See it in action.

Run the RecommendedImplementationReactiveJavaExample. Subscribe to progress, status, and error streams. Watch live events flow from the optimizer into your application.

Documentation  ·  Contact  ·  GitHub