/*
 * Copyright 2015-2019 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.cloud.stream.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.integration.scheduling.PollerMetadata;
import org.springframework.scheduling.support.PeriodicTrigger;

/**
 * @author Dave Syer
 * @author Oleg Zhurakousky
 */
@ConfigurationProperties("spring.cloud.stream.poller")
public class DefaultPollerProperties {

	/**
	 * Fixed delay for default poller.
	 */
	private long fixedDelay = 1000L;

	/**
	 * Maximum messages per poll for the default poller.
	 */
	private long maxMessagesPerPoll = 1L;

	public PollerMetadata getPollerMetadata() {
		PollerMetadata pollerMetadata = new PollerMetadata();
		pollerMetadata.setTrigger(new PeriodicTrigger(this.fixedDelay));
		pollerMetadata.setMaxMessagesPerPoll(this.maxMessagesPerPoll);
		return pollerMetadata;
	}

	public long getFixedDelay() {
		return this.fixedDelay;
	}

	public void setFixedDelay(long fixedDelay) {
		this.fixedDelay = fixedDelay;
	}

	public long getMaxMessagesPerPoll() {
		return this.maxMessagesPerPoll;
	}

	public void setMaxMessagesPerPoll(long maxMessagesPerPoll) {
		this.maxMessagesPerPoll = maxMessagesPerPoll;
	}

}

@@ -20,10 +20,10 @@
 5-20
-19
+20
  the
@@ -808,16 +808,75 @@
 tadata;%0A
+import org.springframework.scheduling.support.CronTrigger;%0A
 import o
@@ -984,16 +984,39 @@
 akousky%0A
+ * @author Soby Chacko%0A
  */%0A@Con
@@ -1291,16 +1291,180 @@
  = 1L;%0A%0A
+%09/**%0A%09 * Cron expression value for the Cron Trigger.%0A%09 */%0A%09private String cron;%0A%0A%09/**%0A%09 * Initial delay for periodic triggers.%0A%09 */%0A%09private int initialDelay = 0;%0A%0A
 %09public 
@@ -1556,16 +1556,39 @@
 data();%0A
+%09%09if (cron != null) %7B%0A%09
 %09%09poller
@@ -1615,42 +1615,223 @@
 new 
-PeriodicTrigger(this.fixedDelay));
+CronTrigger(cron));%0A%09%09%7D%0A%09%09else %7B%0A%09%09%09final PeriodicTrigger periodicTrigger = new PeriodicTrigger(this.fixedDelay);%0A%09%09%09periodicTrigger.setInitialDelay(initialDelay);%0A%09%09%09pollerMetadata.setTrigger(periodicTrigger);%0A%09%09%7D%0A
 %0A%09%09p
@@ -2255,10 +2255,263 @@
 ll;%0A%09%7D%0A%0A
+%09public String getCron() %7B%0A%09%09return cron;%0A%09%7D%0A%0A%09public void setCron(String cron) %7B%0A%09%09this.cron = cron;%0A%09%7D%0A%0A%09public int getInitialDelay() %7B%0A%09%09return initialDelay;%0A%09%7D%0A%0A%09public void setInitialDelay(int initialDelay) %7B%0A%09%09this.initialDelay = initialDelay;%0A%09%7D%0A
 %7D%0A

Add missing properties in DefaultPollerProperties