Uploaded image for project: 'Spring XD'
  1. Spring XD
  2. XD-1922

Make Cron-based Triggers TimeZone aware

    XMLWordPrintable

    Details

    • Type: Story
    • Status: To Do
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 1.2 TRIAGE
    • Component/s: CLI, REST, Runtime, UI
    • Labels:
      None
    • Story Points:
      8
    • Rank (Obsolete):
      1864

      Description

      Currently specified Cron Expressions are executed in the Container's default TimeZone. In Trigger.xml we specify:

      	<beans profile="use-cron">
      		<int:inbound-channel-adapter channel="output"
      			auto-startup="false" expression="'${payload}'">
      			<int:poller cron="${cron}" />
      		</int:inbound-channel-adapter>
      	</beans>
      

      This translates in org.springframework.integration.config.xml.PollerParser to

      BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(CronTrigger.class);
      builder.addConstructorArgValue(cronAttribute)
      

      Which will call org.springframework.scheduling.support.CronTrigger:

      	/**
      	 * Build a {@link CronTrigger} from the pattern provided in the default time zone.
      	 * @param cronExpression a space-separated list of time fields,
      	 * following cron expression conventions
      	 */
      	public CronTrigger(String cronExpression) {
      		this.sequenceGenerator = new CronSequenceGenerator(cronExpression);
      	}
      

      "Build a

      {@link CronTrigger}

      from the pattern provided in the default time zone."

      We need to pass-in a timezone. Should cron expressions as part of an XD *Definition have a TimeZone parameter?* When creating the stream via the UI or the Shell the timezone can be inferred (if not specified) but should be mandatory for the REST API, meaning being passed in as a mandatory parameter (OR alternatively, if not passed in we assume the Cron expression is specified for UTC).

      That way we could ensure that a (Stream/Job) Definition is globally valid.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              hillert Gunnar Hillert
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated: