Reputation: 1045
I have a processing chain that needs to output data at the top of the second, i.e.
System.currentTimeMillis() % 1000 == 0
within +/- 100 milliseconds. So, I set a Quartz timer as follows;
<quartz:inbound-endpoint repeatInterval="1000" responseTimeout="10000" doc:name="Quartz" jobName="publisher" startDelay="900">
<quartz:event-generator-job/>
</quartz:inbound-endpoint>
I notice that the time intervals are fairly steady at 1 second spacing, but the alignment within the second is random, probably depending on when the timer first starts. For example, my last test run output times where
System.currentTimeMillis() % 1000 == 449
I surmise the startDelay applies only to the very first interval. I'm also guessing I might tweak timer alignment if I insert a custom interceptor that uses Thread.sleep to occassionaly tweak it. I.e., if it wakes at 449, Thread.sleep(451). Or, I might set quartz to trigger every 50 milliseconds, and use the custom-interceptor to filter out events out of my desired time range.
Is there a cleaner 'purist' approach to getting Mule to do this?
Upvotes: 0
Views: 369
Reputation: 33413
Replace repeatInterval
with a Cron expression that fires every seconds.
According to the syntax supported by Quartz described in the user guide, the following should work: 0/1 * * ? * *
Upvotes: 2