In this section we will try to execute a job at a certain interval, using Spring Reactor framework. The job should be defined in the subscribe method.
Maven Dependency:
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>3.4.24</version>
</dependency>
Code Snippet:
Running a job at a certain interval (10 sec) forever.
Mono.just("SD").delaySubscription(Duration.ofSeconds(10)).repeat(()->true).subscribe(a->System.out.println(a));
No comments:
Post a Comment