Interface WithTiming

All Superinterfaces:
io.vertx.core.Verticle
All Known Implementing Classes:
Publisher, Requester, SayHello

public interface WithTiming extends io.vertx.core.Verticle
Allows Verticle instances to get simplified access to the Vert.x timing functions like setPeriodic or setTimer.

Usage

 
 public class MyVerticle extends TelestionVerticle<GenericConfiguration> implements WithTiming {
     @Override
     public void onStart() {
         var delay = Duration.ofSeconds(1);
         interval(delay, id -> logger.info("Ping!"));
     }
 }
 
 
  • Method Details

    • interval

      default Timing interval​(long delay, io.vertx.core.Handler<Long> handler)
      Like setPeriodic, but returns a special handler which cancels the interval when called.
      Returns:
      a handler which cancels the interval when called
    • interval

      default Timing interval​(Duration delay, io.vertx.core.Handler<Long> handler)
      Like interval(long, Handler), but accepts a Duration.
    • intervalStream

      default io.vertx.core.TimeoutStream intervalStream​(long delay)
      See Also:
      Vertx.periodicStream(long)
    • intervalStream

      default io.vertx.core.TimeoutStream intervalStream​(Duration delay)
      Like intervalStream(long), but accepts a Duration.
    • timeout

      default Timing timeout​(long delay, io.vertx.core.Handler<Long> handler)
      Like setTimer, but returns a special handler which cancels the timeout when called.
      Returns:
      a handler which cancels the timeout when called
    • timeout

      default Timing timeout​(Duration delay, io.vertx.core.Handler<Long> handler)
      Like timeout(long, Handler), but accepts a Duration.
    • timeoutStream

      default io.vertx.core.TimeoutStream timeoutStream​(long delay)
      See Also:
      Vertx.timerStream(long)
    • timeoutStream

      default io.vertx.core.TimeoutStream timeoutStream​(Duration delay)
      Like timeoutStream(long), but accepts a Duration.