How to do it...

To apply schedulers on our Stream operators, let us perform the following steps:

  1. Create a service class EmployeeScheduledStreamservice that contains the following methods that will make use of the custom dispatcher and thread executor on the main thread:
public interface EmployeeScheduledStreamservice { 
   public Flux<Employee> createPublisherThread(); 
   public Flux<Employee> createSubscriberThread(); 
   public Flux<Employee> createBothThreads(); 
   public Flux<Employee> createPubAndMain(); 
   public Flux<String> createSchedGroupPub(); 
   public Flux<String> createSchedGroupSub(); 
   public Flux<Employee> elasticFlow(); 
   public Flux<String> selectNamesScheduler(); 
} 
  1. The first method to implement is createPublisherThread() which creates a scheduler ...

Get Spring 5.0 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.