O'Reilly logo

TypeScript Microservices by Parth Ghiya

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Backpressure strategy

Up to now, we have played with observables and observers. We imitated our problem using streams of data (observables), transferred it to our desired output (using operators), and threw out some values or some side effects (observers). Now, a case can also occur where an observable is throwing out data faster than what the observer can process. This eventually leads to loss of data, which is called the backpressure problem. To handle back pressure, either we need to accept a loss of data or we need to buffer the observable stream and process it in chunks when losing data is not an option. Different strategies are available in both of the options:

When losing is an option

When losing isn't an option

Debouncing ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required