Exercise A: Obligatory Hello World - ephultman/LearnReactor GitHub Wiki
Publisher and Subscriber
The core elements of all reactive libraries are Publishers and Subscribers. Together, these two components implement the Observer pattern, and more specifically, the Reactive-Streams specification.
You can check out version 1.01 of the R-S specification here if you're curious, but the basic version is this:
Publisher
Emits objects of some type (T) to all Subscribers that have made it known they would like objects. Alternatively, the publisher can notify the subscribers that it has nothing else to publish or that an error has occurred and it is stopping.
An important aspect of Publishers is that they will emit at MOST a number of elements requested by the subscriber - this is useful for a concept known as Backpressure which we'll discuss later.
Subscriber
Accepts objects of some type (T) from a Subscriber and does ... something? with it. A subscriber can not be subscribed to multiple publishers; if it attempts to subscribe to another publisher, it must cancel its old one.
Hot and Cold
Some terminology for how different publishers may work: a HOT publisher starts emitting elements as soon as it is created - it doesn't care if there are any subscribers or not. On the other hand, a COLD publisher will not start until it has at least one subscriber - and stops when all the subscribers have cancelled. In general, the publishers in Project Reactor are cold, but there are exceptions.