Application use cases 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:
Code Block |
---|
|
public class SomeTimeSomeTimer implements Runnable {
@Producer(target="SomeChannel")
protected Channel channel;
public void run() {
Event event = ...
channel.publish(event);
}
}
|
and configuring it in a compositeFurther, 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"):
Code Block |
---|
|
<composite ....>
@Domain
public class SomeTimer implements Runnable {
<component name@Producer(target="Timer">SomeChannel")
protected Channel channel;
public void run() {
<f3:implementation.timer class="Event event = ..."
repeatInterval="10000"/> <producer name="channel" target="SomeChannel"/>channel.publish(event);
}
</composite>
|
...