diff --git a/spring-integration-core/src/main/java/org/springframework/integration/annotation/MessagingGateway.java b/spring-integration-core/src/main/java/org/springframework/integration/annotation/MessagingGateway.java index 29a9012039..6ebb392ad9 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/annotation/MessagingGateway.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/annotation/MessagingGateway.java @@ -68,7 +68,7 @@ public @interface MessagingGateway { * For example if this gateway is hooked up to a {@code QueueChannel}.  * @return the suggested timeout in milliseconds, if any */ - long defaultRequestTimeout() default Long.MIN_VALUE; + String defaultRequestTimeout() default "-9223372036854775808"; /** * Allows to specify how long this gateway will wait for the reply {@code Message} @@ -76,7 +76,7 @@ public @interface MessagingGateway { if the gateway times out. * @return the suggested timeout in milliseconds, if any */ - long defaultReplyTimeout() default Long.MIN_VALUE; + String defaultReplyTimeout() default "-9223372036854775808"; /** * Provide a reference to an implementation of {@link java.util.concurrent.Executor} diff --git a/spring-integration-core/src/test/java/org/springframework/integration/configuration/EnableIntegrationTests.java b/spring-integration-core/src/test/java/org/springframework/integration/configuration/EnableIntegrationTests.java index 74b5896f98..0cef0032c1 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/configuration/EnableIntegrationTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/configuration/EnableIntegrationTests.java @@ -35,7 +35,6 @@ import java.lang.annotation.Target; import java.util.Date; import java.util.List; import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; @@ -44,19 +43,10 @@ import java.util.concurrent.atomic.AtomicReference; import org.aopalliance.intercept.MethodInterceptor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.log4j.Level; -import org.apache.log4j.LogManager; import org.hamcrest.Matchers; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.TestRule; -import org.junit.rules.TestWatcher; -import org.junit.runner.Description; import org.junit.runner.RunWith; -import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -73,7 +63,6 @@ import org.springframework.context.annotation.PropertySource; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import org.springframework.core.convert.converter.Converter; import org.springframework.core.serializer.support.SerializingConverter; -import org.springframework.integration.aggregator.AbstractCorrelatingMessageHandler; import org.springframework.integration.annotation.Aggregator; import org.springframework.integration.annotation.BridgeFrom; import org.springframework.integration.annotation.BridgeTo; @@ -89,7 +78,6 @@ import org.springframework.integration.annotation.ServiceActivator; import org.springframework.integration.annotation.Transformer; import org.springframework.integration.channel.AbstractMessageChannel; import org.springframework.integration.channel.DirectChannel; -import org.springframework.integration.channel.MessagePublishingErrorHandler; import org.springframework.integration.channel.NullChannel; import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.channel.interceptor.WireTap; @@ -99,7 +87,6 @@ import org.springframework.integration.config.EnablePublisher; import org.springframework.integration.config.ExpressionControlBusFactoryBean; import org.springframework.integration.config.GlobalChannelInterceptor; import org.springframework.integration.config.IntegrationConverter; -import org.springframework.integration.context.IntegrationContextUtils; import org.springframework.integration.core.MessagingTemplate; import org.springframework.integration.endpoint.MethodInvokingMessageSource; import org.springframework.integration.endpoint.PollingConsumer; @@ -120,12 +107,10 @@ import org.springframework.messaging.handler.annotation.Payload; import org.springframework.messaging.support.ChannelInterceptor; import org.springframework.messaging.support.ChannelInterceptorAdapter; import org.springframework.messaging.support.GenericMessage; -import org.springframework.scheduling.TaskScheduler; import org.springframework.scheduling.Trigger; import org.springframework.scheduling.TriggerContext; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.EnableAsync; -import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.scheduling.support.CronTrigger; import org.springframework.scheduling.support.PeriodicTrigger; import org.springframework.stereotype.Component; @@ -1248,6 +1233,7 @@ public class EnableIntegrationTests { @Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE}) @Retention(RetentionPolicy.RUNTIME) @MessagingGateway(defaultRequestChannel = "gatewayChannel", reactorEnvironment = "reactorEnv", + defaultRequestTimeout="${default.request.timeout:23}", defaultReplyTimeout="#{34}", defaultHeaders = @GatewayHeader(name = "foo", value = "FOO")) public @interface TestMessagingGateway { diff --git a/src/reference/asciidoc/whats-new.adoc b/src/reference/asciidoc/whats-new.adoc index 5f2a2a6e06..1de1519638 100644 --- a/src/reference/asciidoc/whats-new.adoc +++ b/src/reference/asciidoc/whats-new.adoc @@ -163,12 +163,19 @@ The `AbstractPersistentFileListFilter` has a new property `flushOnUpdate` which, metadata store if it implements `Flushable` (e.g. the `PropertiesPersistenMetadataStore`). -[[x4.2-gw-completable-future]] -==== Gateway Methods can Return CompletableFuture +[[x4.2-gw]] +==== Gateway Changes + +===== Gateway Methods can Return CompletableFuture When using Java 8, gateway methods can now return `CompletableFuture`. See <> for more information. +===== MessagingGateway Annotation + +The request and reply timeout properties are now `String` instead of `Long` to allow configuration with property +placeholders or SpEL. See [[messaging-gateway-annotation]]. + [[x4.2-aggregator-perf]] ==== Aggregator Performance