To apply schedulers on our Stream operators, let us perform the following steps:
- 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(); }
- The first method to implement is createPublisherThread() which creates a scheduler ...