From 7702a6f89e356bbb371d6edd29fe378cd296a25b Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Thu, 25 Oct 2018 16:07:24 -0400 Subject: [PATCH] INT-3887: Add receiveTimeout into the `@Poller` JIRA: https://jira.spring.io/browse/INT-3887 --- .../integration/annotation/Poller.java | 14 +++++++++++++- .../AbstractMethodAnnotationPostProcessor.java | 9 +++++++-- .../configuration/EnableIntegrationTests.java | 17 +++++++++++------ .../EnableIntegrationTests.properties | 1 + src/reference/asciidoc/configuration.adoc | 3 ++- src/reference/asciidoc/whats-new.adoc | 9 ++++++++- 6 files changed, 42 insertions(+), 11 deletions(-) diff --git a/spring-integration-core/src/main/java/org/springframework/integration/annotation/Poller.java b/spring-integration-core/src/main/java/org/springframework/integration/annotation/Poller.java index ab4600d87b..d62f55ac4c 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/annotation/Poller.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/annotation/Poller.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2016 the original author or authors. + * Copyright 2014-2018 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. @@ -39,6 +39,7 @@ import org.springframework.scheduling.support.PeriodicTrigger; * * @author Artem Bilan * @author Gary Russell + * * @since 4.0 */ @Target({}) @@ -92,4 +93,15 @@ public @interface Poller { */ String errorChannel() default ""; + /** + * Only applies to polling consumers. + * @return the time the poll thread will wait after the trigger for a new message to arrive. + * Defaults to 1000 (1 second). + * For polled inbound channel adapters, whether or not the polling thread blocks + * is dependent on the message source implementation. + * Can be specified as 'property placeholder', e.g. {@code ${my.poller.receiveTimeout}}. + * @since 5.1 + */ + String receiveTimeout() default ""; + } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/annotation/AbstractMethodAnnotationPostProcessor.java b/spring-integration-core/src/main/java/org/springframework/integration/config/annotation/AbstractMethodAnnotationPostProcessor.java index 6a8f8aff61..a1a96f698b 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/annotation/AbstractMethodAnnotationPostProcessor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/annotation/AbstractMethodAnnotationPostProcessor.java @@ -364,6 +364,7 @@ public abstract class AbstractMethodAnnotationPostProcessor> * <> * <> +* <> [[x5.1-java-dsl]] ==== Java DSL @@ -222,8 +223,14 @@ See <> for more information. It is now possible to add additional properties to the `IntegrationNode` s via `Function> additionalPropertiesCallback` on the `IntegrationGraphServer`. See <> for more information. -[[x51.-x51.-global-properties]] +[[x51.-global-properties]] === Integration Global Properties The Integration global properties (including defaults) can now be printed in the logs, when a `DEBUG` logic level is turned on for the `org.springframework.integration` category. See <> for more information. + +[[x51.-poller-annotation]] +=== The `receiveTimeout` for `@Poller` + +The `@Poller` annotation now provides a `receiveTimeout` option for convenience. +See <> for more information.