Search code examples
project-reactorcamundareactorreactive-streams

reactor-core crash and restart state


I am new to reactor-core, have done Erlang in the past.

Hopefully a quick question.

Say we send out a message 'A' and then expect a response in x minutes. If the response does not come in x minutes, we run a fallback routine.

It can be done using Flux or Mono with method timeout(duration, fallback)

Here is the API from the rector-core site

public final Mono<T> timeout(Duration timeout,
                             Mono<? extends T> fallback)
Switch to a fallback Mono in case no item arrives within the given Duration.
If the fallback Mono is null, signal a TimeoutException instead.
Parameters:
timeout - the timeout before the onNext signal from this Mono
fallback - the fallback Mono to subscribe to when a timeout occurs
Returns:
a Mono that will fallback to a different Mono in case of timeout

What happens if the JVM crashes and restarts ?

Let's say that the crash and restart takes y minutes.(assume y is less than x)

Does reactor-core know that a crash happened ? Can it restart the processing of the flow, knowing it now needs to wait for (x-y) minutes now ?

I do know that Camunda stores state in a RDBMS. Hence maybe it should recover from a crash.


Solution

  • Reactor is a library aiming at processing live event within the boundaries of a JVM, both in terms of locality of the data being processed AND the lifecycle. Persisting state (to the disk or anywhere really) or recovering from JVM crashes are beyond the scope of the library.