Search in sources :

Example 41 with PeriodicTrigger

use of org.springframework.scheduling.support.PeriodicTrigger in project tutorials by eugenp.

the class ThreadPoolTaskSchedulerConfig method periodicFixedDelayTrigger.

@Bean
public PeriodicTrigger periodicFixedDelayTrigger() {
    PeriodicTrigger periodicTrigger = new PeriodicTrigger(2000, TimeUnit.MICROSECONDS);
    periodicTrigger.setFixedRate(true);
    periodicTrigger.setInitialDelay(1000);
    return periodicTrigger;
}
Also used : PeriodicTrigger(org.springframework.scheduling.support.PeriodicTrigger) Bean(org.springframework.context.annotation.Bean)

Example 42 with PeriodicTrigger

use of org.springframework.scheduling.support.PeriodicTrigger in project paascloud-master by paascloud.

the class CustomPollerConfiguration method customPoller.

/**
 * Custom poller poller metadata.
 *
 * @return the poller metadata
 */
@Bean(name = StreamSpanReporter.POLLER)
PollerMetadata customPoller() {
    PollerMetadata poller = new PollerMetadata();
    poller.setMaxMessagesPerPoll(500);
    poller.setTrigger(new PeriodicTrigger(5000L));
    return poller;
}
Also used : PollerMetadata(org.springframework.integration.scheduling.PollerMetadata) PeriodicTrigger(org.springframework.scheduling.support.PeriodicTrigger) Bean(org.springframework.context.annotation.Bean)

Aggregations

PeriodicTrigger (org.springframework.scheduling.support.PeriodicTrigger)42 AutowireCapableBeanFactory (org.springframework.beans.factory.config.AutowireCapableBeanFactory)20 Before (org.junit.Before)19 BrokenBarrierException (java.util.concurrent.BrokenBarrierException)14 Test (org.junit.Test)14 QueueChannel (org.springframework.integration.channel.QueueChannel)10 PollerMetadata (org.springframework.integration.scheduling.PollerMetadata)10 CountDownLatch (java.util.concurrent.CountDownLatch)8 BeanFactory (org.springframework.beans.factory.BeanFactory)6 Message (org.springframework.messaging.Message)6 SourcePollingChannelAdapter (org.springframework.integration.endpoint.SourcePollingChannelAdapter)5 GenericMessage (org.springframework.messaging.support.GenericMessage)5 NullChannel (org.springframework.integration.channel.NullChannel)4 TestApplicationContext (org.springframework.integration.test.util.TestUtils.TestApplicationContext)4 Trigger (org.springframework.scheduling.Trigger)4 ThreadPoolTaskScheduler (org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler)4 ArrayList (java.util.ArrayList)3 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)3 DirectFieldAccessor (org.springframework.beans.DirectFieldAccessor)3 ConfigurableBeanFactory (org.springframework.beans.factory.config.ConfigurableBeanFactory)3