-
1. Re: ScheduledEventListener onSchedule() is invoked every second
tcunning Nov 30, 2011 8:53 AM (in response to dbuttery)Are you using a custom listener? If so, can you post your example and your jboss-esb.xml? Also what version of ESB / app-server version are you using?
-
2. Re: ScheduledEventListener onSchedule() is invoked every second
dbuttery Nov 30, 2011 9:17 AM (in response to tcunning)Yes. I have a *very* simple custom listener (for now) ... I am using a cron schedule to wake-up every 2 minutes and fetch a file via ftp. I want to be notified upon wakeup (once) so that I can audit/log that the fetch has started, etc...
As of now, the cron trigger fires when it should and the onSchedule() method of my listener is invoked. It is then, however, repeatedly invoked once a second until a full minute has passed by and the cron trigger is apparently no longer valid.
Thanks,
-Dennis
public class MyScheduledEventListener implements ScheduledEventListener {
@Override
public void onSchedule() throws SchedulingException {
System.out.println("MyScheduledEventListener WAKEUP!");
}
@Override
public void initialize(ConfigTree arg0) throws ConfigurationException {
// TODO Auto-generated method stub
}
@Override
public void uninitialize() {
// TODO Auto-generated method stub
}
}
In my jboss-esb.xml providers section I have:
<schedule-provider name="CronSchedule">
<cron-schedule scheduleid="CronSchedule" cronExpression="* 0/2 * * * ?"/>
</schedule-provider>
And ... In my jboss-esb.xml service listeners I have:
<listeners>
<scheduled-listener name="cron-schedule-listener" scheduleidref="CronSchedule"
event-processor="MyScheduledEventListener"
/>
<ftp-listener name="FTPGateway"
busidref="SFTPChannel"
is-gateway="true"
scheduleidref="CronSchedule"/>
</listeners>
-
3. Re: ScheduledEventListener onSchedule() is invoked every second
hauch Nov 30, 2011 9:24 AM (in response to dbuttery)http://www.quartz-scheduler.org/documentation/quartz-2.1.x/tutorials/crontrigger
* ("all values") - used to select all values within a field. For example, "" in the minute field means *"every minute".
try
* 0/2 * * * ?
->
0 0/2 * * * ?
-
4. Re: ScheduledEventListener onSchedule() is invoked every second
dbuttery Nov 30, 2011 9:43 AM (in response to hauch)Thank Morten! That was it. Gross oversight on my part for not examining the cron expression in more detail.
Much appreciated!