Results 1 to 4 of 4

Thread: initial delay for poller

Hybrid View

  1. #1

    Question 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

  2. #2
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    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

  3. #3

    Default

    That is very helpful. Thanks.

  4. #4
    Join Date
    May 2006
    Location
    Madrid
    Posts
    382

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •