Wrapping a Blocking API Call with a Custom Scheduler

Learn how to write a scheduler for a blocking API.

Understanding Reactor

It’s important to understand that the Reactor is actually thread agnostic, which means that using its APIs doesn’t require us to embrace multithreaded programming. Running dozens or hundreds of threads isn’t the answer, but often leads to other issues. When we use Reactor, we create a series of steps when we define a flow, which is shown in the code widget below.

The reactor has a Scheduler that is used to decide what thread carries out each step. It’s possible to write asynchronous, non-blocking code using a single thread!

Get hands-on with 1200+ tech skills courses.