Skip to Content
Hands-On Reactive Programming in Spring 5
book

Hands-On Reactive Programming in Spring 5

by Oleh Dokuka, Igor Lozynskyi
October 2018
Intermediate to advanced
556 pages
15h 18m
English
Packt Publishing
Content preview from Hands-On Reactive Programming in Spring 5

Observer plus iterator equals Reactive Stream

In this chapter, we have talked a lot about the Observer pattern, which gives us a clearly separated view of the Producer event and Consumer event. Let's have a recap of the interfaces defined by that pattern, as shown in the following code:

public interface Observer<T> {   void notify(T event);}public interface Subject<T> {   void registerObserver(Observer<T> observer);   void unregisterObserver(Observer<T> observer);   void notifyObservers(T event);}

As we saw previously, this approach is charming for infinite streams of data, but it would be great to have the ability to signal the end of the data stream. Also, we do not want the Producer to generate events before the appearance of consumers. In the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Spring Microservices in Action, Second Edition

Spring Microservices in Action, Second Edition

John Carnell, Illary Huaylupo Sanchez

Publisher Resources

ISBN: 9781787284951Supplemental Content