Clean up some JavaDocs; remove deprecated API

This commit is contained in:
Artem Bilan
2022-04-08 16:05:43 -04:00
parent 10ea577549
commit 799802c0d1
40 changed files with 182 additions and 1553 deletions

View File

@@ -1,33 +0,0 @@
/*
* Copyright 2015-2020 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.aop;
/**
* Advice for a {@link org.springframework.integration.core.MessageSource#receive()} method to decide whether a poll
* should be ignored and/or take action after the receive.
*
* @author Gary Russell
* @author Artem Bilan
*
* @since 4.2
*
* @deprecated since 5.3 in favor of {@link MessageSourceMutator}.
*/
@Deprecated
public abstract class AbstractMessageSourceAdvice implements MessageSourceMutator {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2020 the original author or authors.
* Copyright 2015-2022 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.
@@ -18,7 +18,6 @@ package org.springframework.integration.aop;
import org.springframework.integration.core.MessageSource;
import org.springframework.integration.util.CompoundTrigger;
import org.springframework.lang.Nullable;
import org.springframework.messaging.Message;
import org.springframework.scheduling.Trigger;
import org.springframework.util.Assert;
@@ -55,17 +54,9 @@ public class CompoundTriggerAdvice
* @param result the received message.
* @param source the message source.
* @return the message or null
* @deprecated since 5.3 in favor of {@link #afterReceive(Message, Object)}
*/
@Override
@Deprecated
public Message<?> afterReceive(Message<?> result, MessageSource<?> source) {
return afterReceive(result, (Object) source);
}
@Override
@Nullable
public Message<?> afterReceive(@Nullable Message<?> result, Object source) {
if (result == null) {
this.compoundTrigger.setOverride(this.override);
}

View File

@@ -1,83 +0,0 @@
/*
* Copyright 2015-2020 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.aop;
import java.time.Duration;
import org.springframework.integration.core.MessageSource;
import org.springframework.integration.util.DynamicPeriodicTrigger;
import org.springframework.messaging.Message;
/**
* A simple advice that polls at one rate when messages exist and another when
* there are no messages.
*
* @author Gary Russell
*
* @since 4.2
*
* @see DynamicPeriodicTrigger
*
* @deprecated since 5.3 in favor of {@link SimpleActiveIdleReceiveMessageAdvice} with the same
* (but more common) functionality.
*/
@Deprecated
public class SimpleActiveIdleMessageSourceAdvice extends AbstractMessageSourceAdvice {
private final DynamicPeriodicTrigger trigger;
private volatile Duration idlePollPeriod;
private volatile Duration activePollPeriod;
public SimpleActiveIdleMessageSourceAdvice(DynamicPeriodicTrigger trigger) {
this.trigger = trigger;
this.idlePollPeriod = trigger.getDuration();
this.activePollPeriod = trigger.getDuration();
}
/**
* Set the poll period when messages are not returned. Defaults to the
* trigger's period.
* @param idlePollPeriod the period in milliseconds.
*/
public void setIdlePollPeriod(long idlePollPeriod) {
this.idlePollPeriod = Duration.ofMillis(idlePollPeriod);
}
/**
* Set the poll period when messages are returned. Defaults to the
* trigger's period.
* @param activePollPeriod the period in milliseconds.
*/
public void setActivePollPeriod(long activePollPeriod) {
this.activePollPeriod = Duration.ofMillis(activePollPeriod);
}
@Override
public Message<?> afterReceive(Message<?> result, MessageSource<?> source) {
if (result == null) {
this.trigger.setDuration(this.idlePollPeriod);
}
else {
this.trigger.setDuration(this.activePollPeriod);
}
return result;
}
}

View File

@@ -1,44 +0,0 @@
/*
* Copyright 2017-2020 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.channel;
import org.reactivestreams.Publisher;
import org.springframework.integration.util.IntegrationReactiveUtils;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
/**
* Utilities for adaptation {@link MessageChannel}s to the {@link Publisher}s.
*
* @author Artem Bilan
*
* @since 5.0
*
* @deprecated since 5.3 in favor of {@link IntegrationReactiveUtils}.
*/
@Deprecated
public final class MessageChannelReactiveUtils {
private MessageChannelReactiveUtils() {
}
public static <T> Publisher<Message<T>> toPublisher(MessageChannel messageChannel) {
return IntegrationReactiveUtils.messageChannelToFlux(messageChannel);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2021 the original author or authors.
* Copyright 2014-2022 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.
@@ -42,33 +42,19 @@ import org.springframework.integration.support.management.micrometer.MicrometerM
@Import({ MicrometerMetricsCaptorImportSelector.class, IntegrationManagementConfiguration.class })
public @interface EnableIntegrationManagement {
/**
* @deprecated this property is no longer used.
* @return the patterns.
*/
@Deprecated
String[] metersEnabled() default "*";
/**
* @deprecated this property is no longer used.
* @return the value; false by default, or true when JMX is enabled.
*/
@Deprecated
String defaultCountsEnabled() default "false";
/**
* Use to disable all logging in the main message flow in framework components. When 'false', such logging will be
* skipped, regardless of logging level. When 'true', the logging is controlled as normal by the logging
* subsystem log level configuration.
* Use for disabling all logging in the main message flow in framework components. When 'false',
* such logging will be skipped, regardless of logging level. When 'true',
* the logging is controlled as normal by the logging subsystem log level configuration.
* <p>
* It has been found that in high-volume messaging environments, calls to methods such as
* {@code logger.isDebuggingEnabled()} can be quite expensive and account for an inordinate amount of CPU
* time.
* <p>
* Set this to false to disable logging by default in all framework components that implement
* Set this to false for disabling logging by default in all framework components that implement
* {@link org.springframework.integration.support.management.IntegrationManagement}
* (channels, message handlers etc). This turns off logging such as
* "PreSend on channel", "Received message" etc.
* (channels, message handlers etc). It turns off logging such as "PreSend on channel", "Received message" etc.
* <p>
* After the context is initialized, individual components can have their setting changed by invoking
* {@link org.springframework.integration.support.management.IntegrationManagement#setLoggingEnabled(boolean)}.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2021 the original author or authors.
* Copyright 2014-2022 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.
@@ -20,7 +20,6 @@ import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.context.IntegrationContextUtils;
/**
* Shared utility methods for Integration configuration.
@@ -31,12 +30,6 @@ import org.springframework.integration.context.IntegrationContextUtils;
*/
public final class IntegrationConfigUtils {
/**
* @deprecated in favor of {@link IntegrationContextUtils#BASE_PACKAGE}.
*/
@Deprecated
public static final String BASE_PACKAGE = IntegrationContextUtils.BASE_PACKAGE;
public static final String HANDLER_ALIAS_SUFFIX = ".handler";
public static void registerSpelFunctionBean(BeanDefinitionRegistry registry, String functionId, String className,

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 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.
@@ -110,12 +110,6 @@ public abstract class IntegrationContextUtils {
public static final String ARGUMENT_RESOLVER_MESSAGE_CONVERTER_BEAN_NAME =
"integrationArgumentResolverMessageConverter";
/**
* @deprecated since 5.5.7 - out of use.
*/
@Deprecated
public static final String DISPOSABLES_BEAN_NAME = "integrationDisposableAutoCreatedBeans";
public static final String MESSAGE_HANDLER_FACTORY_BEAN_NAME = "integrationMessageHandlerMethodFactory";
public static final String LIST_MESSAGE_HANDLER_FACTORY_BEAN_NAME = "integrationListMessageHandlerMethodFactory";
@@ -209,8 +203,7 @@ public abstract class IntegrationContextUtils {
propertiesToRegister.putAll(userProperties);
}
if (beanFactory instanceof BeanDefinitionRegistry) {
BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory;
if (beanFactory instanceof BeanDefinitionRegistry registry) {
RootBeanDefinition beanDefinition = new RootBeanDefinition(Properties.class);
beanDefinition.setInstanceSupplier(() -> propertiesToRegister);

View File

@@ -631,7 +631,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
/**
* Populate the {@link MessageTransformingHandler} instance for the
* {@link org.springframework.integration.handler.MessageProcessor} from provided {@link MessageProcessorSpec}.
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
* <pre class="code">
* {@code
* .transform(Scripts.script("classpath:myScript.py").variable("foo", bar()),
@@ -708,7 +708,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
/**
* Populate the {@link MessageTransformingHandler} instance for the provided {@link GenericTransformer}
* for the specific {@code expectedType} to convert at runtime.
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
* @param expectedType the {@link Class} for expected payload type. It can also be
* {@code Message.class} if you wish to access the entire message in the transformer.
* Conversion to this type will be attempted, if necessary.
@@ -744,7 +744,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
/**
* Populate a {@link MessageFilter} with {@link MessageSelector} for the provided SpEL expression.
* In addition accept options for the integration endpoint using {@link FilterEndpointSpec}:
* In addition, accept options for the integration endpoint using {@link FilterEndpointSpec}:
* <pre class="code">
* {@code
* .filter("payload.hot"), e -> e.autoStartup(false))
@@ -820,7 +820,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
* Populate a {@link MessageFilter} with {@link MethodInvokingSelector}
* for the {@link MessageProcessor} from
* the provided {@link MessageProcessorSpec}.
* In addition accept options for the integration endpoint using {@link FilterEndpointSpec}.
* In addition, accept options for the integration endpoint using {@link FilterEndpointSpec}.
* <pre class="code">
* {@code
* .filter(Scripts.script(scriptResource).lang("ruby"),
@@ -910,7 +910,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
/**
* Populate a {@link ServiceActivatingHandler} for the provided
* {@link MessageHandler} implementation.
* Can be used as Java 8 Lambda expression:
* Can be used as Lambda expression:
* <pre class="code">
* {@code
* .handle(m -> logger.info(m.getPayload())
@@ -939,7 +939,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
* Populate a {@link ServiceActivatingHandler} for the
* {@link org.springframework.integration.handler.MethodInvokingMessageProcessor}
* to invoke the {@code method} for provided {@code bean} at runtime.
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
* @param beanName the bean name to use.
* @param methodName the method to invoke.
* @param endpointConfigurer the {@link Consumer} to provide integration endpoint options.
@@ -966,7 +966,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
* Populate a {@link ServiceActivatingHandler} for the
* {@link org.springframework.integration.handler.MethodInvokingMessageProcessor}
* to invoke the {@code method} for provided {@code bean} at runtime.
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
* @param service the service object to use.
* @param methodName the method to invoke.
* @return the current {@link BaseIntegrationFlowDefinition}.
@@ -979,7 +979,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
* Populate a {@link ServiceActivatingHandler} for the
* {@link org.springframework.integration.handler.MethodInvokingMessageProcessor}
* to invoke the {@code method} for provided {@code bean} at runtime.
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
* @param service the service object to use.
* @param methodName the method to invoke.
* @param endpointConfigurer the {@link Consumer} to provide integration endpoint options.
@@ -1002,7 +1002,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
* Populate a {@link ServiceActivatingHandler} for the
* {@link org.springframework.integration.handler.MethodInvokingMessageProcessor}
* to invoke the provided {@link GenericHandler} at runtime.
* Typically, used with a Java 8 Lambda expression:
* Typically, used with a Lambda expression:
* <pre class="code">
* {@code
* .handle(Integer.class, (p, h) -> p / 2)
@@ -1024,8 +1024,8 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
* Populate a {@link ServiceActivatingHandler} for the
* {@link org.springframework.integration.handler.MethodInvokingMessageProcessor}
* to invoke the provided {@link GenericHandler} at runtime.
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
* Typically used with a Java 8 Lambda expression:
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
* Typically, used with a Lambda expression:
* <pre class="code">
* {@code
* .handle(Integer.class, (p, h) -> p / 2, e -> e.autoStartup(false))
@@ -1076,7 +1076,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
* Populate a {@link ServiceActivatingHandler} for the
* {@link MessageProcessor} from the provided
* {@link MessageProcessorSpec}.
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
* <pre class="code">
* {@code
* .handle(Scripts.script("classpath:myScript.ruby"), e -> e.autoStartup(false))
@@ -1098,8 +1098,8 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
/**
* Populate a {@link ServiceActivatingHandler} for the selected protocol specific
* {@link MessageHandler} implementation from {@code Namespace Factory}:
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
* Typically used with a Java 8 Lambda expression:
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
* Typically, used with a Lambda expression:
* <pre class="code">
* {@code
* .handle(Amqp.outboundAdapter(this.amqpTemplate).routingKeyExpression("headers.routingKey"),
@@ -1125,8 +1125,8 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
/**
* Populate a {@link ServiceActivatingHandler} for the provided
* {@link MessageHandler} implementation.
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
* Can be used as Java 8 Lambda expression:
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
* Can be used as Lambda expression:
* <pre class="code">
* {@code
* .handle(m -> logger.info(m.getPayload()), e -> e.autoStartup(false))
@@ -1153,7 +1153,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
/**
* Populate a {@link BridgeHandler} to the current integration flow position.
* Typically used with a Java 8 Lambda expression:
* Typically, used with a Lambda expression:
* <pre class="code">
* {@code
* .bridge(s -> s.poller(Pollers.fixedDelay(100))
@@ -1196,7 +1196,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
* Populate a {@link org.springframework.integration.transformer.ContentEnricher}
* to the current integration flow position
* with provided options.
* Typically used with a Java 8 Lambda expression:
* Typically, used with a Lambda expression:
* <pre class="code">
* {@code
* .enrich(e -> e.requestChannel("enrichChannel")
@@ -1239,7 +1239,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
* Populate a {@link MessageTransformingHandler} for
* a {@link org.springframework.integration.transformer.HeaderEnricher}
* using header values from provided {@link MapBuilder}.
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
* Can be used together with {@code Namespace Factory}:
* <pre class="code">
* {@code
@@ -1297,7 +1297,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
* Populate a {@link MessageTransformingHandler} for
* a {@link org.springframework.integration.transformer.HeaderEnricher}
* as the result of provided {@link Consumer}.
* Typically used with a Java 8 Lambda expression:
* Typically, used with a Lambda expression:
* <pre class="code">
* {@code
* .enrichHeaders(h -> h.header(FileHeaders.FILENAME, "foo.sitest")
@@ -1325,7 +1325,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
/**
* Populate the {@link DefaultMessageSplitter} with provided options
* to the current integration flow position.
* Typically used with a Java 8 Lambda expression:
* Typically, used with a Lambda expression:
* <pre class="code">
* {@code
* .split(s -> s.applySequence(false).delimiters(","))
@@ -1341,8 +1341,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
}
/**
* Populate the {@link ExpressionEvaluatingSplitter} with provided
* SpEL expression.
* Populate the {@link ExpressionEvaluatingSplitter} with provided SpEL expression.
* @param expression the splitter SpEL expression.
* and for {@link ExpressionEvaluatingSplitter}.
* @return the current {@link BaseIntegrationFlowDefinition}.
@@ -1353,8 +1352,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
}
/**
* Populate the {@link ExpressionEvaluatingSplitter} with provided
* SpEL expression.
* Populate the {@link ExpressionEvaluatingSplitter} with provided SpEL expression.
* @param expression the splitter SpEL expression.
* @param endpointConfigurer the {@link Consumer} to provide integration endpoint options
* and for {@link ExpressionEvaluatingSplitter}.
@@ -1392,7 +1390,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
/**
* Populate the {@link MethodInvokingSplitter} to evaluate the provided
* {@code method} of the {@code bean} at runtime.
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
* @param service the service to use.
* @param methodName the method to invoke.
* @param endpointConfigurer the {@link Consumer} to provide integration endpoint options
@@ -1428,7 +1426,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
/**
* Populate the {@link MethodInvokingSplitter} to evaluate the provided
* {@code method} of the {@code bean} at runtime.
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
* @param beanName the bean name to use.
* @param methodName the method to invoke at runtime.
* @param endpointConfigurer the {@link Consumer} to provide integration endpoint options
@@ -1464,7 +1462,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
* Populate the {@link MethodInvokingSplitter} to evaluate the
* {@link MessageProcessor} at runtime
* from provided {@link MessageProcessorSpec}.
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
* <pre class="code">
* {@code
* .split(Scripts.script(myScriptResource).lang("groovy").refreshCheckDelay(1000),
@@ -1489,7 +1487,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
/**
* Populate the {@link MethodInvokingSplitter} to evaluate the provided
* {@link Function} at runtime.
* Typically, used with a Java 8 Lambda expression:
* Typically, used with a Lambda expression:
* <pre class="code">
* {@code
* .split(String.class, p ->
@@ -1516,7 +1514,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
* Populate the {@link MethodInvokingSplitter} to evaluate the provided
* {@link Function} at runtime.
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
* Typically, used with a Java 8 Lambda expression:
* Typically, used with a Lambda expression:
* <pre class="code">
* {@code
* .split(String.class, p ->
@@ -1627,8 +1625,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
}
/**
* Populate the provided {@link MessageTransformingHandler} for the provided
* {@link HeaderFilter}.
* Populate the provided {@link MessageTransformingHandler} for the provided {@link HeaderFilter}.
* @param headerFilter the {@link HeaderFilter} to use.
* @param endpointConfigurer the {@link Consumer} to provide integration endpoint options.
* @return the current {@link BaseIntegrationFlowDefinition}.
@@ -1653,7 +1650,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
/**
* Populate the {@link MessageTransformingHandler} for the {@link ClaimCheckInTransformer}
* with provided {@link MessageStore}.
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
* @param messageStore the {@link MessageStore} to use.
* @param endpointConfigurer the {@link Consumer} to provide integration endpoint options.
* @return the current {@link BaseIntegrationFlowDefinition}.
@@ -1691,7 +1688,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
/**
* Populate the {@link MessageTransformingHandler} for the {@link ClaimCheckOutTransformer}
* with provided {@link MessageStore} and {@code removeMessage} flag.
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
* @param messageStore the {@link MessageStore} to use.
* @param removeMessage the removeMessage boolean flag.
* @param endpointConfigurer the {@link Consumer} to provide integration endpoint options.
@@ -1722,7 +1719,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
* {@link org.springframework.integration.aggregator.ResequencingMessageHandler} with
* provided options from {@link ResequencerSpec}.
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
* Typically used with a Java 8 Lambda expression:
* Typically, used with a Lambda expression:
* <pre class="code">
* {@code
* .resequence(r -> r.releasePartialSequences(true)
@@ -1761,7 +1758,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
/**
* Populate the {@link AggregatingMessageHandler} with provided options from {@link AggregatorSpec}.
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
* Typically used with a Java 8 Lambda expression:
* Typically, used with a Lambda expression:
* <pre class="code">
* {@code
* .aggregate(a -> a.correlationExpression("1")
@@ -1875,7 +1872,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
/**
* Populate the {@link MethodInvokingRouter} for provided {@link Function}
* and payload type with default options.
* Typically used with a Java 8 Lambda expression:
* Typically, used with a Lambda expression:
* <pre class="code">
* {@code
* .route(Integer.class, p -> p % 2 == 0)
@@ -1898,7 +1895,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
* Populate the {@link MethodInvokingRouter} for provided {@link Function}
* and payload type and options from {@link RouterSpec}.
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
* Typically, used with a Java 8 Lambda expression:
* Typically, used with a Lambda expression:
* <pre class="code">
* {@code
* .route(Integer.class, p -> p % 2 == 0,
@@ -1992,8 +1989,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
if (!CollectionUtils.isEmpty(componentsToRegister)) {
for (Map.Entry<Object, String> entry : componentsToRegister.entrySet()) {
Object component = entry.getKey();
if (component instanceof BaseIntegrationFlowDefinition) {
BaseIntegrationFlowDefinition<?> flowBuilder = (BaseIntegrationFlowDefinition<?>) component;
if (component instanceof BaseIntegrationFlowDefinition<?> flowBuilder) {
if (flowBuilder.isOutputChannelRequired()) {
registerSubflowBridge = true;
flowBuilder.channel(new FixedSubscriberChannel(bridgeHandler));
@@ -2020,7 +2016,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
/**
* Populate the {@link RecipientListRouter} with options from the {@link RecipientListRouterSpec}.
* Typically used with a Java 8 Lambda expression:
* Typically, used with a Lambda expression:
* <pre class="code">
* {@code
* .routeToRecipients(r -> r
@@ -2040,7 +2036,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
/**
* Populate the {@link ErrorMessageExceptionTypeRouter} with options from the {@link RouterSpec}.
* Typically used with a Java 8 Lambda expression:
* Typically, used with a Lambda expression:
* <pre class="code">
* {@code
* .routeByException(r -> r
@@ -2072,7 +2068,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
/**
* Populate the provided {@link AbstractMessageRouter} implementation to the
* current integration flow position.
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
* @param router the {@link AbstractMessageRouter} to populate.
* @param endpointConfigurer the {@link Consumer} to provide integration endpoint options.
* @param <R> the {@link AbstractMessageRouter} type.
@@ -2144,7 +2140,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
* Populate the "artificial"
* {@link org.springframework.integration.gateway.GatewayMessageHandler} for the
* provided {@code subflow}.
* Typically used with a Java 8 Lambda expression:
* Typically, used with aLambda expression:
* <pre class="code">
* {@code
* .gateway(f -> f.transform("From Gateway SubFlow: "::concat))
@@ -2161,7 +2157,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
* Populate the "artificial"
* {@link org.springframework.integration.gateway.GatewayMessageHandler} for the
* provided {@code subflow} with options from {@link GatewayEndpointSpec}.
* Typically used with a Java 8 Lambda expression:
* Typically, used with a Lambda expression:
* <pre class="code">
* {@code
* .gateway(f -> f.transform("From Gateway SubFlow: "::concat), e -> e.replyTimeout(100L))
@@ -3009,8 +3005,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
channelName = ((MessageChannelReference) outputChannel).getName();
}
if (currComponent instanceof MessageProducer) {
MessageProducer messageProducer = (MessageProducer) currComponent;
if (currComponent instanceof MessageProducer messageProducer) {
checkReuse(messageProducer);
if (channelName != null) {
messageProducer.setOutputChannelName(channelName);
@@ -3108,10 +3103,9 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
}
protected static Object extractProxyTarget(Object target) {
if (!(target instanceof Advised)) {
if (!(target instanceof Advised advised)) {
return target;
}
Advised advised = (Advised) target;
try {
return extractProxyTarget(advised.getTargetSource().getTarget());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2021 the original author or authors.
* Copyright 2016-2022 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.
@@ -181,19 +181,14 @@ public abstract class CorrelationHandlerSpec<S extends CorrelationHandlerSpec<S,
* @see AbstractCorrelatingMessageHandler#setReleaseStrategy(ReleaseStrategy)
*/
public S processor(Object target) {
try {
CorrelationStrategyFactoryBean correlationStrategyFactoryBean = new CorrelationStrategyFactoryBean();
correlationStrategyFactoryBean.setTarget(target);
correlationStrategyFactoryBean.afterPropertiesSet();
ReleaseStrategyFactoryBean releaseStrategyFactoryBean = new ReleaseStrategyFactoryBean();
releaseStrategyFactoryBean.setTarget(target);
releaseStrategyFactoryBean.afterPropertiesSet();
return correlationStrategy(correlationStrategyFactoryBean.getObject())
.releaseStrategy(releaseStrategyFactoryBean.getObject());
}
catch (Exception e) {
throw new IllegalStateException(e);
}
CorrelationStrategyFactoryBean correlationStrategyFactoryBean = new CorrelationStrategyFactoryBean();
correlationStrategyFactoryBean.setTarget(target);
correlationStrategyFactoryBean.afterPropertiesSet();
ReleaseStrategyFactoryBean releaseStrategyFactoryBean = new ReleaseStrategyFactoryBean();
releaseStrategyFactoryBean.setTarget(target);
releaseStrategyFactoryBean.afterPropertiesSet();
return correlationStrategy(correlationStrategyFactoryBean.getObject())
.releaseStrategy(releaseStrategyFactoryBean.getObject());
}
/**
@@ -217,16 +212,11 @@ public abstract class CorrelationHandlerSpec<S extends CorrelationHandlerSpec<S,
* @see AbstractCorrelatingMessageHandler#setCorrelationStrategy(CorrelationStrategy)
*/
public S correlationStrategy(Object target, String methodName) {
try {
CorrelationStrategyFactoryBean correlationStrategyFactoryBean = new CorrelationStrategyFactoryBean();
correlationStrategyFactoryBean.setTarget(target);
correlationStrategyFactoryBean.setMethodName(methodName);
correlationStrategyFactoryBean.afterPropertiesSet();
return correlationStrategy(correlationStrategyFactoryBean.getObject());
}
catch (Exception e) {
throw new IllegalStateException(e);
}
CorrelationStrategyFactoryBean correlationStrategyFactoryBean = new CorrelationStrategyFactoryBean();
correlationStrategyFactoryBean.setTarget(target);
correlationStrategyFactoryBean.setMethodName(methodName);
correlationStrategyFactoryBean.afterPropertiesSet();
return correlationStrategy(correlationStrategyFactoryBean.getObject());
}
/**
@@ -242,7 +232,6 @@ public abstract class CorrelationHandlerSpec<S extends CorrelationHandlerSpec<S,
/**
* Configure the handler with an {@link ExpressionEvaluatingReleaseStrategy} for the
* given expression.
*
* @param releaseExpression the correlation expression.
* @return the handler spec.
* @see AbstractCorrelatingMessageHandler#setReleaseStrategy(ReleaseStrategy)
@@ -261,16 +250,11 @@ public abstract class CorrelationHandlerSpec<S extends CorrelationHandlerSpec<S,
* @see AbstractCorrelatingMessageHandler#setReleaseStrategy(ReleaseStrategy)
*/
public S releaseStrategy(Object target, String methodName) {
try {
ReleaseStrategyFactoryBean releaseStrategyFactoryBean = new ReleaseStrategyFactoryBean();
releaseStrategyFactoryBean.setTarget(target);
releaseStrategyFactoryBean.setMethodName(methodName);
releaseStrategyFactoryBean.afterPropertiesSet();
return releaseStrategy(releaseStrategyFactoryBean.getObject());
}
catch (Exception e) {
throw new IllegalStateException(e);
}
ReleaseStrategyFactoryBean releaseStrategyFactoryBean = new ReleaseStrategyFactoryBean();
releaseStrategyFactoryBean.setTarget(target);
releaseStrategyFactoryBean.setMethodName(methodName);
releaseStrategyFactoryBean.afterPropertiesSet();
return releaseStrategy(releaseStrategyFactoryBean.getObject());
}
/**
@@ -335,19 +319,6 @@ public abstract class CorrelationHandlerSpec<S extends CorrelationHandlerSpec<S,
return _this();
}
/**
* Configure a timeout for old groups in the store to purge.
* @param expireTimeout the timeout in milliseconds to use.
* @return the endpoint spec.
* @since 5.4
* @deprecated since 5.5 in favor of {@link #expireTimeout(long)}
* @see AbstractCorrelatingMessageHandler#setExpireTimeout(long)
*/
@Deprecated
public S setExpireTimeout(long expireTimeout) {
return expireTimeout(expireTimeout);
}
/**
* Configure a timeout for old groups in the store to purge.
* @param expireTimeout the timeout in milliseconds to use.
@@ -360,19 +331,6 @@ public abstract class CorrelationHandlerSpec<S extends CorrelationHandlerSpec<S,
return _this();
}
/**
* Configure a {@link Duration} how often to run a scheduled purge task.
* @param expireDuration the duration for scheduled purge task.
* @return the endpoint spec.
* @since 5.4
* @deprecated since 5.5 in favor of {@link #expireDuration(Duration)}
* @see AbstractCorrelatingMessageHandler#setExpireDuration(Duration)
*/
@Deprecated
public S setExpireDuration(Duration expireDuration) {
return expireDuration(expireDuration);
}
/**
* Configure a {@link Duration} how often to run a scheduled purge task.
* @param expireDuration the duration for scheduled purge task.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018-2020 the original author or authors.
* Copyright 2018-2022 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.
@@ -19,10 +19,7 @@ package org.springframework.integration.support.management.micrometer;
import java.util.concurrent.TimeUnit;
import java.util.function.ToDoubleFunction;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.integration.support.management.metrics.CounterFacade;
import org.springframework.integration.support.management.metrics.GaugeFacade;
import org.springframework.integration.support.management.metrics.MeterFacade;
@@ -95,38 +92,7 @@ public class MicrometerMetricsCaptor implements MetricsCaptor {
return facade.remove();
}
/**
* Add a MicrometerMetricsCaptor to the context if there's a MeterRegistry; if
* there's already a {@link MetricsCaptor} bean, return that.
* @param applicationContext the application context.
* @return the instance.
* @deprecated since 5.2.9 in favor of {@code @Import(MicrometerMetricsCaptorRegistrar.class)};
* will be removed in 6.0.
*/
@Deprecated
public static MetricsCaptor loadCaptor(ApplicationContext applicationContext) {
try {
MeterRegistry registry = applicationContext.getBean(MeterRegistry.class);
if (applicationContext instanceof GenericApplicationContext
&& !applicationContext.containsBean(MICROMETER_CAPTOR_NAME)) {
((GenericApplicationContext) applicationContext).registerBean(MICROMETER_CAPTOR_NAME,
MicrometerMetricsCaptor.class,
() -> new MicrometerMetricsCaptor(registry));
}
return applicationContext.getBean(MICROMETER_CAPTOR_NAME, MetricsCaptor.class);
}
catch (NoSuchBeanDefinitionException e) {
return null;
}
}
private static class MicroSample implements SampleFacade {
private final Timer.Sample sample;
MicroSample(Timer.Sample sample) {
this.sample = sample;
}
private record MicroSample(Timer.Sample sample) implements SampleFacade {
@SuppressWarnings("unchecked")
@Override

View File

@@ -1,177 +0,0 @@
/*
* Copyright 2019-2021 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.util;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
/**
* Chained utility methods to simplify some Java repetitive code. Obtain a reference to
* the singleton {@link #INSTANCE} and then chain calls to the utility methods.
*
* @author Gary Russell
* @author Artem Bilan
*
* @since 5.1.3
*
* @deprecated since 5.5.6 in favor of {@link org.springframework.integration.JavaUtils}.
*/
@Deprecated
public final class JavaUtils {
/**
* The singleton instance of this utility class.
*/
public static final JavaUtils INSTANCE = new JavaUtils();
private JavaUtils() {
}
/**
* Invoke {@link Consumer#accept(Object)} with the value if the condition is true.
* @param condition the condition.
* @param value the value.
* @param consumer the consumer.
* @param <T> the value type.
* @return this.
*/
public <T> JavaUtils acceptIfCondition(boolean condition, T value, Consumer<T> consumer) {
if (condition) {
consumer.accept(value);
}
return this;
}
/**
* Invoke {@link Consumer#accept(Object)} with the value if it is not null.
* @param value the value.
* @param consumer the consumer.
* @param <T> the value type.
* @return this.
*/
public <T> JavaUtils acceptIfNotNull(T value, Consumer<T> consumer) {
if (value != null) {
consumer.accept(value);
}
return this;
}
/**
* Invoke {@link Consumer#accept(Object)} with the value if it is not null or empty.
* @param value the value.
* @param consumer the consumer.
* @return this.
* @since 5.2
*/
public JavaUtils acceptIfHasText(String value, Consumer<String> consumer) {
if (StringUtils.hasText(value)) {
consumer.accept(value);
}
return this;
}
/**
* Invoke {@link Consumer#accept(Object)} with the value if it is not null or empty.
* @param value the value.
* @param consumer the consumer.
* @param <T> the value type.
* @return this.
* @since 5.2
*/
public <T> JavaUtils acceptIfNotEmpty(List<T> value, Consumer<List<T>> consumer) {
if (!CollectionUtils.isEmpty(value)) {
consumer.accept(value);
}
return this;
}
/**
* Invoke {@link Consumer#accept(Object)} with the value if it is not null or empty.
* @param value the value.
* @param consumer the consumer.
* @param <T> the value type.
* @return this.
* @since 5.2
*/
public <T> JavaUtils acceptIfNotEmpty(T[] value, Consumer<T[]> consumer) {
if (!ObjectUtils.isEmpty(value)) {
consumer.accept(value);
}
return this;
}
/**
* Invoke {@link BiConsumer#accept(Object, Object)} with the arguments if the
* condition is true.
* @param condition the condition.
* @param t1 the first consumer argument
* @param t2 the second consumer argument
* @param consumer the consumer.
* @param <T1> the first argument type.
* @param <T2> the second argument type.
* @return this.
* @since 5.2
*/
public <T1, T2> JavaUtils acceptIfCondition(boolean condition, T1 t1, T2 t2, BiConsumer<T1, T2> consumer) {
if (condition) {
consumer.accept(t1, t2);
}
return this;
}
/**
* Invoke {@link BiConsumer#accept(Object, Object)} with the arguments if the t2
* argument is not null.
* @param t1 the first argument
* @param t2 the second consumer argument
* @param consumer the consumer.
* @param <T1> the first argument type.
* @param <T2> the second argument type.
* @return this.
* @since 5.2
*/
public <T1, T2> JavaUtils acceptIfNotNull(T1 t1, T2 t2, BiConsumer<T1, T2> consumer) {
if (t2 != null) {
consumer.accept(t1, t2);
}
return this;
}
/**
* Invoke {@link BiConsumer#accept(Object, Object)} with the arguments if the value
* argument is not null or empty.
* @param t1 the first consumer argument.
* @param value the second consumer argument
* @param <T> the first argument type.
* @param consumer the consumer.
* @return this.
* @since 5.2
*/
public <T> JavaUtils acceptIfHasText(T t1, String value, BiConsumer<T, String> consumer) {
if (StringUtils.hasText(value)) {
consumer.accept(t1, value);
}
return this;
}
}