Handling multiple producers with DirectProcessor

Viewed 81

The javadoc for DirectProcessor from project reactor says

Please note, that along with multiple consumers, current implementation of DirectProcessor supports multiple producers. However, all producers must produce messages on the same Thread, otherwise Reactive Streams Spec contract is violated.

Does this requirement mean that all onNext, onError, onComplete must be invoked on the same thread? Or does this only applies to messages that are submitted concurrently without happens-before between the submissions? Looking at the implementation of the processor, it does seem to be safe to use it from multiple threads as long as two messages are never submitted concurrently.

To paraphrase the question, is it safe to call onNext from different threads as long as there is happen-before relation between these calls?

0 Answers
Related