Reactor Flux and Mono provide a wide choice of subscribe methods. Reactive publishers raise four types of events, namely subscription, value, completion, and error. Individual functions can be registered for each of the events. We can also register a subscriber without listening to any kind of event. Let's look at all of the possible variants offered, as follows:
fibonacciGenerator.subscribe(); (1)
fibonacciGenerator.subscribe(t -> System.out.println("consuming " + t)); (2)
fibonacciGenerator.subscribe(t -> System.out.println("consuming " + t),
e -> e.printStackTrace() ); (3)
fibonacciGenerator.subscribe(t -> System.out.println("consuming " + t),
e -> e.printStackTrace(),
()-> System.out.println("Finished")); (4)
fibonacciGenerator.subscribe...