Add missing timeUnit in DefaultPollerProperties
Fixing docs Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2052 Resolves #2053
This commit is contained in:
committed by
Oleg Zhurakousky
parent
8cf5e62820
commit
02c642ff99
@@ -550,6 +550,21 @@ Maximum messages for each polling event of the default poller.
|
||||
+
|
||||
Default: 1L.
|
||||
|
||||
cron::
|
||||
Cron expression value for the Cron Trigger.
|
||||
+
|
||||
Default: none.
|
||||
|
||||
initialDelay::
|
||||
Initial delay for periodic triggers.
|
||||
+
|
||||
Default: 0.
|
||||
|
||||
timeUnit::
|
||||
The TimeUnit to apply to delay values.
|
||||
+
|
||||
Default: MILLISECONDS.
|
||||
|
||||
For example `--spring.cloud.stream.poller.fixed-delay=2000` sets the poller interval to poll every two seconds.
|
||||
|
||||
===== Sending arbitrary data to an output (e.g. Foreign event-driven sources)
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.cloud.stream.config;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.integration.scheduling.PollerMetadata;
|
||||
import org.springframework.scheduling.support.CronTrigger;
|
||||
@@ -49,13 +51,18 @@ public class DefaultPollerProperties {
|
||||
*/
|
||||
private int initialDelay = 0;
|
||||
|
||||
/**
|
||||
* The TimeUnit to apply to delay values.
|
||||
*/
|
||||
private TimeUnit timeUnit = TimeUnit.MILLISECONDS;
|
||||
|
||||
public PollerMetadata getPollerMetadata() {
|
||||
PollerMetadata pollerMetadata = new PollerMetadata();
|
||||
if (cron != null) {
|
||||
pollerMetadata.setTrigger(new CronTrigger(cron));
|
||||
}
|
||||
else {
|
||||
final PeriodicTrigger periodicTrigger = new PeriodicTrigger(this.fixedDelay);
|
||||
final PeriodicTrigger periodicTrigger = new PeriodicTrigger(this.fixedDelay, this.timeUnit);
|
||||
periodicTrigger.setInitialDelay(initialDelay);
|
||||
pollerMetadata.setTrigger(periodicTrigger);
|
||||
}
|
||||
@@ -95,4 +102,12 @@ public class DefaultPollerProperties {
|
||||
public void setInitialDelay(int initialDelay) {
|
||||
this.initialDelay = initialDelay;
|
||||
}
|
||||
|
||||
public TimeUnit getTimeUnit() {
|
||||
return timeUnit;
|
||||
}
|
||||
|
||||
public void setTimeUnit(TimeUnit timeUnit) {
|
||||
this.timeUnit = timeUnit;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user