Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current Restore this Version View Page History

« Previous Version 6 Next »

Application use cases 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 SomeTime implements Runnable {

   @Producer
   protected Channel channel;

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

and configuring it in a composite:

<composite ....>
   <component name="Timer">
      <f3:implementation.timer class="..." repeatInterval="10000"/>
      <producer name="channel" target="SomeChannel"/>
   </component>
</composite>

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

@Scope("DOMAIN")
public class SomeTime implements Runnable {

   @Producer
   protected Channel channel;

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