Rxfified version

Wanna use #schedulerx with #reactivex or #mutiny on #vertx…​

Stay tuned, one more step

scheduler.x supports out of the box almost reactive version that officially supports by Vert.x

Dependencies setup

To use scheduler.x API with reactive version, add the following dependency to the dependencies section of your build descriptor:

Maven

In your pom.xml

<dependencies>
    <dependency>
       <groupId>io.vertx</groupId>
       <artifactId>vertx-rx-java3</artifactId>                     (1)
       <version>4.4.4</version>
    </dependency>
    <dependency>
       <groupId>io.smallrye.reactive</groupId>
       <artifactId>smallrye-mutiny-vertx-core</artifactId>         (2)
       <version>2.27.0</version>
    </dependency>
    <dependency>
      <groupId>io.github.zero88</groupId>
      <artifactId>schedulerx</artifactId>
      <version>2.0.0-SNAPSHOT</version>
    </dependency>
</dependencies>
1 For using Rx3 version
2 For using mutiny version

Gradle

Gradle (in your build.gradle):

dependencies {
    api 'io.vertx:vertx-core:4.4.4'
    api 'io.github.zero88:schedulerx:2.0.0-SNAPSHOT'
    // with rx3
    api 'io.vertx:vertx-rx-java3:4.4.4'                               (1)
    // or with mutiny
    api 'io.smallrye.reactive:smallrye-mutiny-vertx-core:2.27.0'      (2)
    // other your libs...
}
1 For using Rx3 version
2 For using mutiny version

Gradle (in your build.gradle.kts):

dependencies {
  api("io.vertx:vertx-core:4.4.4")
  api("io.github.zero88:schedulerx:2.0.0-SNAPSHOT")
  // with rx3
  api("io.vertx:vertx-rx-java3:4.4.4")                                (1)
  // or with mutiny
  api("io.smallrye.reactive:smallrye-mutiny-vertx-core:2.27.0")       (2)
  // other your libs...
}
1 For using Rx3 version
2 For using mutiny version

Well done, now you can enjoy Rxify version with a little effort

Cookbook

Rx3 - By schedulerx instance

io.github.zero88.schedulerx.IntervalScheduler scheduler
    = io.github.zero88.schedulerx.IntervalScheduler.builder()
                                                   .setVertx(vertx)
                                                   .setTrigger(trigger)
                                                   .setJob(job)
                                                   .build();
// create rx3 schedulerx by non-rxify version
io.github.zero88.schedulerx.rxjava3.IntervalScheduler rxScheduler
    = io.github.zero88.schedulerx.rxjava3.IntervalScheduler.newInstance(scheduler);
rxScheduler.start();

Rx3 - By schedulerx builder

io.vertx.rxjava3.core.Vertx vertxRx3 = io.vertx.rxjava3.core.Vertx.newInstance(vertx);
io.vertx.rxjava3.core.WorkerExecutor workerExecutor = vertxRx3.createSharedWorkerExecutor("hello-rx3");

// Create rx3 schedulerx by builder
io.github.zero88.schedulerx.rxjava3.CronScheduler rxScheduler
    = io.github.zero88.schedulerx.rxjava3.CronScheduler.builder()
                                                       .setVertx(vertxRx3)
                                                       .setTrigger(trigger)
                                                       .setJob(job)
                                                       .build();
// Start scheduler with rx3 worker
rxScheduler.start(workerExecutor);

Mutiny - By schedulerx builder

io.vertx.mutiny.core.Vertx vertxMutiny = io.vertx.mutiny.core.Vertx.newInstance(vertx);
io.vertx.mutiny.core.WorkerExecutor workerExecutor = vertxMutiny.createSharedWorkerExecutor("hello-mutiny");

// Create mutiny scheduler by builder
io.github.zero88.schedulerx.mutiny.EventScheduler<JsonObject> mutinyScheduler
    = io.github.zero88.schedulerx.mutiny.EventScheduler.<Object, Object, JsonObject>builder()
                                                       .setVertx(vertxMutiny)
                                                       .setTrigger(trigger)
                                                       .setJob(job)
                                                       .build();
// Start scheduler with mutiny worker
mutinyScheduler.start(workerExecutor);

Mutiny Job

You can create a new Job that compatible to Mutiny version also

io.vertx.mutiny.core.Vertx vertxMutiny = io.vertx.mutiny.core.Vertx.newInstance(vertx);
// Create new example mutiny job instance
ExampleMutinyJob job = new ExampleMutinyJob();
// Create mutiny scheduler within Mutiny job then start
io.github.zero88.schedulerx.mutiny.IntervalScheduler.<Void, String>builder()
                                                    .setVertx(vertxMutiny)
                                                    .setTrigger(trigger)
                                                    .setJob(job)
                                                    .build()
                                                    .start();

And then, pass it to the Mutiny builder

io.vertx.mutiny.core.Vertx vertxMutiny = io.vertx.mutiny.core.Vertx.newInstance(vertx);
// Create new example mutiny job instance
ExampleMutinyJob job = new ExampleMutinyJob();
// Create mutiny scheduler within Mutiny job then start
io.github.zero88.schedulerx.mutiny.IntervalScheduler.<Void, String>builder()
                                                    .setVertx(vertxMutiny)
                                                    .setTrigger(trigger)
                                                    .setJob(job)
                                                    .build()
                                                    .start();