-
initial delay for poller
I noticed following in my logs:
"Configuration problem: Poller configuration via 'interval-trigger' subelements is deprecated, use the 'fixed-delay' or 'fixed-rate' attribute instead."
If interval-trigger is deprecated, what is the way of setting 'initial-delay' with 'fixed-delay'/'fixed-rate'?
Thanks
-
You can provide the "trigger" attribute and reference a bean of type PeriodicTrigger. That bean can be configured with initialDelay as well as its other properties.
Hope that helps.
-Mark
-
That is very helpful. Thanks.
-
Hello pgondi,
I appreciate a lot your question.
And thanks to Mark for the response.
I would have prefered to use the namespace:
Code:
<task:executor id="senderTaskExecutor" pool-size="5" queue-capacity="50" /><!-- WorkManagerTaskExecutor in production -->
<int:inbound-channel-adapter id="senderPoller" ref="myServiceActivator" method="obtainRecordsToBeSent" channel="out">
<int:poller initial-delay="${sender.initialDelay}" fixed-rate="${sender.frequency}" time-unit="SECONDS" task-executor="senderTaskExecutor"/>
</int:inbound-channel-adapter>
Instead of creating my own bean:
Code:
<task:executor id="senderTaskExecutor" pool-size="5" queue-capacity="50" /><!-- WorkManagerTaskExecutor in production -->
<bean id="senderTrigger" class="org.springframework.scheduling.support.PeriodicTrigger"
c:period="${sender.frequency}" c:timeUnit="SECONDS"
p:initialDelay="${sender.initialDelay}"
/>
<int:inbound-channel-adapter id="senderPoller" ref="myServiceActivator" method="obtainRecordsToBeSent" channel="out">
<int:poller trigger="senderTrigger" task-executor="senderTaskExecutor" />
</int:inbound-channel-adapter>
Maybe it would be possible to parse a "initial-delay" attribute when configuring the trigger at PollerParser.configureTrigger(...). Of course, if it creates a PeriodicTrigger.
But I don't know if it's that useful (I have problems in tests, because I need to populate a database before the execution of the task that selects from that database)
In any case, Mark's response has helped me