1

I've been reading on the Reactor design pattern here, and it mentions project-reactor as a "Real world example" of this design pattern. However, I couldn't find any mention or even a hint in project-reactor of the Reactor design pattern other than using the word "reactor" in the name.

I'm wondering the author of java-design-patterns just pulled that "fact" out of thin air or not.

traveh
  • 2,700
  • 3
  • 27
  • 44
  • 1
    There is a more general question on difference between reactor pattern and reactive steams (which project reactor is one of the implementations) here https://stackoverflow.com/questions/69479765/reactive-streams-vs-reactor-pattern – Pavel Dec 30 '22 at 20:37
  • 1
    Thanks. So according to that answer, the author of "java-design-patterns" indeed just pulled that "fact" out of thin air. – traveh Dec 30 '22 at 20:40

1 Answers1

2

Project reactor is directed towards building non-blocking applications. It's threading model does allow using small number of threads.

From reading the docs still still seems to consider themselves as based on the Reactor design pattern (although it is supposed to be for single threads) because it's possible to run it in a single-thread environment.

According to the docs:

Obtaining a Flux or a Mono does not necessarily mean that it runs in a dedicated Thread. Instead, most operators continue working in the Thread on which the previous operator executed.

However, you can use an ExecutorService with multiple threads (see this post for instructions).