INT-3615: @MessagingGateway Long Properties

JIRA: https://jira.spring.io/browse/INT-3615

Change timeout properties from long to String to allow
property placeholder/SpEL configuration.
This commit is contained in:
Gary Russell
2015-06-30 09:10:38 -04:00
committed by Artem Bilan
parent 4131c82faf
commit 029bb28cfa
3 changed files with 12 additions and 19 deletions

View File

@@ -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}

View File

@@ -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 {

View File

@@ -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 <<gw-completable-future>> 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