Child pages
  • Timed Events
Skip to end of metadata
Go to start of metadata

Applications often require sending recurring or timed notifications. This can be done by creating a timer component that has a producer connected to a channel:

public class SomeTimer implements Runnable {

   @Producer(target="SomeChannel")
   protected Channel channel;

   public void run() {
      Event event = ...
      channel.publish(event);
   }
}

Further, to limit timed events to a highly-available single source in a clustered zone (i.e. a clustered singleton), mark the implementation with @Domain or @Scope("DOMAIN"):

@Domain
public class SomeTimer implements Runnable {

   @Producer(target="SomeChannel")
   protected Channel channel;

   public void run() {
      Event event = ...
      channel.publish(event);
   }
}
Write a comment…