Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-8625: Add Duration support for <poller> #8627

Merged
merged 2 commits into from May 22, 2023

Conversation

artembilan
Copy link
Member

Fixes #8625

The duration can be represented in a ISO 8601 format, e.g. PT10S, P1D etc. The <poller> and @Poller don't support such a format.

  • Introduce a PeriodicTriggerFactoryBean to accept string values for trigger options and parse them manually before creating the target PeriodicTrigger
  • Use this PeriodicTriggerFactoryBean in the PollerParser and AbstractMethodAnnotationPostProcessor where we parse options for the PeriodicTrigger
  • Modify tests to ensure that feature works
  • Document the duration option
  • Add more cross-links into polling docs
  • Fix typos in the affected doc files
  • Add -parameters for compiler options since SF 6.1 does not support -debug anymore for method parameter names discovery

Fixes spring-projects#8625

The duration can be represented in a ISO 8601 format, e.g. `PT10S`, `P1D` etc.
The `<poller>` and `@Poller` don't support such a format.

* Introduce a `PeriodicTriggerFactoryBean` to accept string values for
trigger options and parse them manually before creating the target `PeriodicTrigger`
* Use this `PeriodicTriggerFactoryBean` in the `PollerParser` and `AbstractMethodAnnotationPostProcessor`
where we parse options for the `PeriodicTrigger`
* Modify tests to ensure that feature works
* Document the duration option
* Add more cross-links into polling docs
* Fix typos in the affected doc files
* Add `-parameters` for compiler options since SF 6.1 does not support `-debug` anymore
for method parameter names discovery
src/reference/asciidoc/channel-adapter.adoc Outdated Show resolved Hide resolved

private static Duration toDuration(String value, TimeUnit timeUnit) {
if (isDurationString(value)) {
return Duration.parse(value);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assert that timeUnit is not provided in this case?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having time-unit does not cause any ambiguity, so ignoring it as it is also done in the ScheduledAnnotationBeanPostProcessor should be totally OK.

Co-authored-by: Gary Russell <grussell@vmware.com>
@garyrussell garyrussell merged commit c70d7a6 into spring-projects:main May 22, 2023
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Poller fixed-delay and fixed-rate support for Duration syntax
2 participants