Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Reactive Programming with Reactor

You're reading from   Hands-On Reactive Programming with Reactor Build reactive and scalable microservices using the Reactor framework

Arrow left icon
Product type Paperback
Published in Sep 2018
Publisher Packt
ISBN-13 9781789135794
Length 250 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Table of Contents (13) Chapters Close

Preface 1. Getting Started with Reactive Streams 2. The Publisher and Subscriber APIs in a Reactor FREE CHAPTER 3. Data and Stream Processing 4. Processors 5. SpringWebFlux for Microservices 6. Dynamic Rendering 7. Flow Control and Backpressure 8. Handling Errors 9. Execution Control 10. Testing and Debugging 11. Assessments 12. Other Books You May Enjoy

Stream subscriber

A subscriber is used to listen to events generated by a publisher. When a subscriber registers to a publisher, it receives events in the following order:

As a result, the subscriber has the following interface to handle all of these events:

public interface Subscriber<T> {
public void onSubscribe(Subscription s);
public void onNext(T t);
public void onError(Throwable t);
public void onComplete();
}

Let's cover each of these methods in detail, as follows:

  • onSubscribe(Subscription s): As soon as a publisher has received a subscriber, it generates a subscription event. The generated subscription event is then received in the specified method.
  • onNext (T): All data events generated by a publisher are received by the subscriber in the specified method. A publisher may or may not publish a data event before closing the stream.
  • onCompletion()...
You have been reading a chapter from
Hands-On Reactive Programming with Reactor
Published in: Sep 2018
Publisher: Packt
ISBN-13: 9781789135794
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime