diff --git a/build.gradle b/build.gradle index 20ff8935a9..5d3aaeccf8 100644 --- a/build.gradle +++ b/build.gradle @@ -48,7 +48,7 @@ ext { files() .from { files(grgit.status().unstaged.modified) - .filter { f -> f.name.endsWith('.java') || f.name.endsWith('.kt') } + .filter { f -> f.name.endsWith('.java') || f.name.endsWith('.kt') || f.name.endsWith('.groovy') } } modifiedFiles.finalizeValueOnRead() diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/BaseIntegrationFlowDefinition.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/BaseIntegrationFlowDefinition.java index c2b8ea8626..eebb697a52 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/BaseIntegrationFlowDefinition.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/BaseIntegrationFlowDefinition.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 the original author or authors. + * Copyright 2019-2024 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. @@ -552,25 +552,6 @@ public abstract class BaseIntegrationFlowDefinition transformerSpec.expression(expression)); } - /** - * Populate the {@code Transformer} EI Pattern specific {@link MessageHandler} implementation - * for the SpEL {@link Expression}. - * @param expression the {@code Transformer} {@link Expression}. - * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options. - * @return the current {@link BaseIntegrationFlowDefinition}. - * @deprecated since 6.2 in favor of {@link #transformWith(Consumer)}. - * @see ExpressionEvaluatingTransformer - */ - @Deprecated(since = "6.2", forRemoval = true) - public B transform(String expression, - @Nullable Consumer> endpointConfigurer) { - - Assert.hasText(expression, "'expression' must not be empty"); - return transform(null, - new ExpressionEvaluatingTransformer(PARSER.parseExpression(expression)), - endpointConfigurer); - } - /** * Populate the {@code MessageTransformingHandler} for the {@link MethodInvokingTransformer} * to invoke the discovered service method at runtime. @@ -623,31 +604,6 @@ public abstract class BaseIntegrationFlowDefinition transformerSpec.refName(beanName).method(methodName)); } - /** - * Populate the {@code MessageTransformingHandler} for the {@link MethodInvokingTransformer} - * to invoke the service method at runtime. - * @param service the service to use. - * @param methodName the method to invoke. - * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options. - * @return the current {@link BaseIntegrationFlowDefinition}. - * @deprecated since 6.2 in favor of {@link #transformWith(Consumer)}. - * @see MethodInvokingTransformer - */ - @Deprecated(since = "6.2", forRemoval = true) - public B transform(Object service, @Nullable String methodName, - @Nullable Consumer> endpointConfigurer) { - - MethodInvokingTransformer transformer; - if (StringUtils.hasText(methodName)) { - transformer = new MethodInvokingTransformer(service, methodName); - } - else { - transformer = new MethodInvokingTransformer(service); - } - - return transform(null, transformer, endpointConfigurer); - } - /** * Populate the {@link MessageTransformingHandler} instance for the * {@link MessageProcessor} from provided {@link MessageProcessorSpec}. @@ -670,32 +626,6 @@ public abstract class BaseIntegrationFlowDefinition transformerSpec.processor(messageProcessorSpec)); } - /** - * Populate the {@link MessageTransformingHandler} instance for the - * {@link MessageProcessor} from provided {@link MessageProcessorSpec}. - * In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}. - *
-	 * {@code
-	 *  .transform(Scripts.script("classpath:myScript.py").variable("foo", bar()),
-	 *           e -> e.autoStartup(false))
-	 * }
-	 * 
- * @param messageProcessorSpec the {@link MessageProcessorSpec} to use. - * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options. - * @return the current {@link BaseIntegrationFlowDefinition}. - * @deprecated since 6.2 in favor of {@link #transformWith(Consumer)}. - * @see MethodInvokingTransformer - */ - @Deprecated(since = "6.2", forRemoval = true) - public B transform(MessageProcessorSpec messageProcessorSpec, - @Nullable Consumer> endpointConfigurer) { - - Assert.notNull(messageProcessorSpec, MESSAGE_PROCESSOR_SPEC_MUST_NOT_BE_NULL); - MessageProcessor processor = messageProcessorSpec.getObject(); - return addComponent(processor) - .transform(null, new MethodInvokingTransformer(processor), endpointConfigurer); - } - /** * Populate the {@link MessageTransformingHandler} instance * for the provided {@code payloadType} to convert at runtime. @@ -762,13 +692,11 @@ public abstract class BaseIntegrationFlowDefinition the payload type - 'transform from', or {@code Message.class}. * @param the target type - 'transform to'. * @return the current {@link BaseIntegrationFlowDefinition}. - * @deprecated since 6.2 in favor of {@link #transformWith(Consumer)} * @see MethodInvokingTransformer * @see LambdaMessageProcessor * @see GenericEndpointSpec */ - @Deprecated(since = "6.2", forRemoval = true) - public B transform(@Nullable Class

expectedType, GenericTransformer genericTransformer, + private B transform(@Nullable Class

expectedType, GenericTransformer genericTransformer, @Nullable Consumer> endpointConfigurer) { Assert.notNull(genericTransformer, "'genericTransformer' must not be null"); @@ -1252,20 +1180,6 @@ public abstract class BaseIntegrationFlowDefinition delayer.messageGroupId(groupId)); } - /** - * Populate a {@link DelayHandler} to the current integration flow position. - * @param groupId the {@code groupId} for delayed messages in the - * {@link org.springframework.integration.store.MessageGroupStore}. - * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options. - * @return the current {@link BaseIntegrationFlowDefinition}. - * @deprecated since 6.2 in favor of {@link #delay(Consumer)} - * @see DelayerEndpointSpec - */ - @Deprecated(since = "6.2", forRemoval = true) - public B delay(String groupId, @Nullable Consumer endpointConfigurer) { - return register(new DelayerEndpointSpec(new DelayHandler(groupId)), endpointConfigurer); - } - /** * Populate a {@link DelayHandler} to the current integration flow position. * The {@link DelayerEndpointSpec#messageGroupId(String)} is required option. @@ -1408,28 +1322,6 @@ public abstract class BaseIntegrationFlowDefinition { }); } - /** - * Populate the {@link DefaultMessageSplitter} with provided options - * to the current integration flow position. - * Typically, used with a Lambda expression: - *

-	 * {@code
-	 *  .split(s -> s.applySequence(false).delimiters(","))
-	 * }
-	 * 
- * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options - * and for {@link DefaultMessageSplitter}. - * @return the current {@link BaseIntegrationFlowDefinition}. - * @deprecated since 6.2 in favor of {@link #splitWith(Consumer)}. - * @see SplitterEndpointSpec - */ - @Deprecated(since = "6.2", forRemoval = true) - @SuppressWarnings("removal") - public B split(@Nullable Consumer> endpointConfigurer) { - return split(new DefaultMessageSplitter(), endpointConfigurer); - } - - /** * Populate the splitter with provided options to the current integration flow position: *
@@ -1463,24 +1355,6 @@ public abstract class BaseIntegrationFlowDefinition splitterSpec.expression(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}.
-	 * @return the current {@link BaseIntegrationFlowDefinition}.
-	 * @deprecated since 6.2 in favor of {@link #splitWith(Consumer)}.
-	 * @see SplitterEndpointSpec
-	 */
-	@Deprecated(since = "6.2", forRemoval = true)
-	@SuppressWarnings("removal")
-	public B split(String expression,
-			@Nullable Consumer> endpointConfigurer) {
-
-		Assert.hasText(expression, "'expression' must not be empty");
-		return split(new ExpressionEvaluatingSplitter(PARSER.parseExpression(expression)), endpointConfigurer);
-	}
-
 	/**
 	 * Populate the {@link MethodInvokingSplitter} to evaluate the discovered
 	 * {@code method} of the {@code service} at runtime.
@@ -1504,34 +1378,6 @@ public abstract class BaseIntegrationFlowDefinition splitterSpec.ref(service).method(methodName));
 	}
 
-	/**
-	 * 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}.
-	 * @param service the service to use.
-	 * @param methodName the method to invoke.
-	 * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options
-	 * and for {@link MethodInvokingSplitter}.
-	 * @return the current {@link BaseIntegrationFlowDefinition}.
-	 * @deprecated since 6.2 in favor of {@link #splitWith(Consumer)}.
-	 * @see SplitterEndpointSpec
-	 * @see MethodInvokingSplitter
-	 */
-	@Deprecated(since = "6.2", forRemoval = true)
-	@SuppressWarnings("removal")
-	public B split(Object service, @Nullable String methodName,
-			@Nullable Consumer> endpointConfigurer) {
-
-		MethodInvokingSplitter splitter;
-		if (StringUtils.hasText(methodName)) {
-			splitter = new MethodInvokingSplitter(service, methodName);
-		}
-		else {
-			splitter = new MethodInvokingSplitter(service);
-		}
-		return split(splitter, endpointConfigurer);
-	}
-
 	/**
 	 * Populate the {@link MethodInvokingSplitter} to evaluate the provided
 	 * {@code method} of the {@code bean} at runtime.
@@ -1543,27 +1389,6 @@ public abstract class BaseIntegrationFlowDefinition splitterSpec.refName(beanName).method(methodName));
 	}
 
-	/**
-	 * 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}.
-	 * @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
-	 * and for {@link MethodInvokingSplitter}.
-	 * @return the current {@link BaseIntegrationFlowDefinition}.
-	 * @deprecated since 6.2 in favor of {@link #splitWith(Consumer)}.
-	 * @see SplitterEndpointSpec
-	 */
-	@Deprecated(since = "6.2", forRemoval = true)
-	@SuppressWarnings("removal")
-	public B split(String beanName, @Nullable String methodName,
-			@Nullable Consumer> endpointConfigurer) {
-
-		return split(new MethodInvokingSplitter(new BeanNameMessageProcessor<>(beanName, methodName)),
-				endpointConfigurer);
-	}
-
 	/**
 	 * Populate the {@link MethodInvokingSplitter} to evaluate the
 	 * {@link MessageProcessor} at runtime
@@ -1581,35 +1406,6 @@ public abstract class BaseIntegrationFlowDefinition splitterSpec.ref(messageProcessorSpec));
 	}
 
-	/**
-	 * 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}.
-	 * 
-	 * {@code
-	 *  .split(Scripts.script(myScriptResource).lang("groovy").refreshCheckDelay(1000),
-	 *  			, e -> e.applySequence(false))
-	 * }
-	 * 
- * @param messageProcessorSpec the splitter {@link MessageProcessorSpec}. - * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options - * and for {@link MethodInvokingSplitter}. - * @return the current {@link BaseIntegrationFlowDefinition}. - * @deprecated since 6.2 in favor of {@link #splitWith(Consumer)}. - * @see SplitterEndpointSpec - */ - @Deprecated(since = "6.2", forRemoval = true) - @SuppressWarnings("removal") - public B split(MessageProcessorSpec messageProcessorSpec, - @Nullable Consumer> endpointConfigurer) { - - Assert.notNull(messageProcessorSpec, MESSAGE_PROCESSOR_SPEC_MUST_NOT_BE_NULL); - MessageProcessor processor = messageProcessorSpec.getObject(); - return addComponent(processor) - .split(new MethodInvokingSplitter(processor), endpointConfigurer); - } - /** * Populate the {@link MethodInvokingSplitter} to evaluate the provided * {@link Function} at runtime. @@ -1636,45 +1432,6 @@ public abstract class BaseIntegrationFlowDefinition splitterSpec.function(splitter).expectedType(expectedType)); } - /** - * 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 Lambda expression: - *
-	 * {@code
-	 *  .split(String.class, p ->
-	 *        jdbcTemplate.execute("SELECT * from FOO",
-	 *            (PreparedStatement ps) ->
-	 *                 new ResultSetIterator(ps.executeQuery(),
-	 *                     (rs, rowNum) ->
-	 *                           new Foo(rs.getInt(1), rs.getString(2))))
-	 *       , e -> e.applySequence(false))
-	 * }
-	 * 
- * @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 splitter. - * Conversion to this type will be attempted, if necessary. - * @param splitter the splitter {@link Function}. - * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options. - * @param

the payload type or {@code Message.class}. - * @return the current {@link BaseIntegrationFlowDefinition}. - * @deprecated since 6.2 in favor of {@link #splitWith(Consumer)}. - * @see LambdaMessageProcessor - * @see SplitterEndpointSpec - */ - @Deprecated(since = "6.2", forRemoval = true) - @SuppressWarnings("removal") - public

B split(@Nullable Class

expectedType, Function splitter, - @Nullable Consumer> endpointConfigurer) { - - MethodInvokingSplitter split = - ClassUtils.isLambda(splitter.getClass()) - ? new MethodInvokingSplitter(new LambdaMessageProcessor(splitter, expectedType)) - : new MethodInvokingSplitter(splitter, ClassUtils.FUNCTION_APPLY_METHOD); - return split(split, endpointConfigurer); - } - /** * Populate the provided {@link AbstractMessageSplitter} to the current integration * flow position. @@ -1687,25 +1444,6 @@ public abstract class BaseIntegrationFlowDefinition splitterSpec.ref(splitterMessageHandlerSpec)); } - /** - * Populate the provided {@link AbstractMessageSplitter} to the current integration - * flow position. - * @param splitterMessageHandlerSpec the {@link MessageHandlerSpec} to populate. - * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options. - * @param the {@link AbstractMessageSplitter} - * @return the current {@link BaseIntegrationFlowDefinition}. - * @deprecated since 6.2 in favor of {@link #splitWith(Consumer)}. - * @see SplitterEndpointSpec - */ - @Deprecated(since = "6.2", forRemoval = true) - @SuppressWarnings("removal") - public B split(MessageHandlerSpec splitterMessageHandlerSpec, - @Nullable Consumer> endpointConfigurer) { - - Assert.notNull(splitterMessageHandlerSpec, "'splitterMessageHandlerSpec' must not be null"); - return split(splitterMessageHandlerSpec.getObject(), endpointConfigurer); - } - /** * Populate the provided {@link AbstractMessageSplitter} to the current integration * flow position. @@ -1717,25 +1455,6 @@ public abstract class BaseIntegrationFlowDefinition splitterSpec.ref(splitter)); } - /** - * Populate the provided {@link AbstractMessageSplitter} to the current integration - * flow position. - * @param splitter the {@link AbstractMessageSplitter} to populate. - * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options. - * @param the {@link AbstractMessageSplitter} - * @return the current {@link BaseIntegrationFlowDefinition}. - * @deprecated since 6.2 in favor of {@link #splitWith(Consumer)}. - * @see SplitterEndpointSpec - */ - @Deprecated(since = "6.2", forRemoval = true) - @SuppressWarnings("removal") - public B split(S splitter, - @Nullable Consumer> endpointConfigurer) { - - Assert.notNull(splitter, "'splitter' must not be null"); - return register(new SplitterEndpointSpec<>(splitter), endpointConfigurer); - } - /** * Provide the {@link HeaderFilter} to the current {@link StandardIntegrationFlow}. * @param headersToRemove the array of headers (or patterns) @@ -1746,22 +1465,6 @@ public abstract class BaseIntegrationFlowDefinition headerFilterSpec - .headersToRemove(StringUtils.delimitedListToStringArray(headersToRemove, ",", " ")) - .patternMatch(patternMatch)); - } - /** * Provide the {@link HeaderFilter} options via fluent API of the {@link HeaderFilterSpec}. * @param headerFilter the {@link Consumer} to provide header filter and its endpoint options. diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java index 38b09a1b0d..b7940e827e 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2023 the original author or authors. + * Copyright 2016-2024 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. @@ -24,7 +24,6 @@ import org.springframework.integration.core.GenericSelector; import org.springframework.integration.core.GenericTransformer; import org.springframework.integration.handler.ServiceActivatingHandler; import org.springframework.integration.router.MethodInvokingRouter; -import org.springframework.integration.splitter.MethodInvokingSplitter; import org.springframework.integration.transformer.MessageTransformingHandler; /** @@ -67,32 +66,6 @@ public abstract class IntegrationFlowDefinition transformerSpec.transformer(genericTransformer)); } - - /** - * Populate the {@link MessageTransformingHandler} instance for the provided - * {@link GenericTransformer}. In addition, accept options for the integration endpoint - * using {@link GenericEndpointSpec}. Use - * {@code .transform((transformerSpec) -> transformerSpec.function(genericTransformer).expectedType(Message.class))} - * if you need to access the entire message. - * @param genericTransformer the {@link GenericTransformer} to populate. - * @param endpointConfigurer the {@link Consumer} to provide integration endpoint - * options. - * @param the source type - 'transform from'. - * @param the target type - 'transform to'. - * @return the current {@link IntegrationFlowDefinition}. - * @deprecated since 6.2 in favor of {@link #transformWith(Consumer)} - * @see org.springframework.integration.transformer.MethodInvokingTransformer - * @see org.springframework.integration.handler.LambdaMessageProcessor - * @see GenericEndpointSpec - */ - @Deprecated(since = "6.2", forRemoval = true) - @SuppressWarnings("removal") - public B transform(GenericTransformer genericTransformer, - Consumer> endpointConfigurer) { - - return transform(null, genericTransformer, endpointConfigurer); - } - /** * Populate a {@link org.springframework.integration.filter.MessageFilter} * with {@link org.springframework.integration.filter.MethodInvokingSelector} @@ -183,38 +156,6 @@ public abstract class IntegrationFlowDefinition - * {@code - * .split(p -> - * jdbcTemplate.execute("SELECT * from FOO", - * (PreparedStatement ps) -> - * new ResultSetIterator(ps.executeQuery(), - * (rs, rowNum) -> - * new Foo(rs.getInt(1), rs.getString(2)))) - * , e -> e.applySequence(false)) - * } - *

- * @param splitter the splitter {@link Function}. - * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options. - * @param

the payload type. - * @return the current {@link IntegrationFlowDefinition}. - * @deprecated since 6.2 in favor of {@link #splitWith(Consumer)}. - * @see org.springframework.integration.handler.LambdaMessageProcessor - * @see SplitterEndpointSpec - */ - @Deprecated(since = "6.2", forRemoval = true) - @SuppressWarnings("removal") - public

B split(Function splitter, - Consumer> endpointConfigurer) { - - return split(null, splitter, endpointConfigurer); - } - /** * Populate the {@link MethodInvokingRouter} for provided {@link Function} * with default options. diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/SplitterEndpointSpec.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/SplitterEndpointSpec.java deleted file mode 100644 index 05bb5efac6..0000000000 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/SplitterEndpointSpec.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2016-2023 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.dsl; - -import org.springframework.integration.splitter.AbstractMessageSplitter; -import org.springframework.integration.splitter.DefaultMessageSplitter; -import org.springframework.messaging.MessageChannel; - -/** - * A {@link ConsumerEndpointSpec} for a {@link AbstractMessageSplitter} implementations. - * - * @param the target {@link SplitterEndpointSpec} implementation type. - * - * @author Artem Bilan - * - * @since 5.0 - * - * @deprecated since 6.2 in favor of {@link SplitterSpec} - */ -@Deprecated(since = "6.2", forRemoval = true) -public class SplitterEndpointSpec - extends ConsumerEndpointSpec, S> { - - protected SplitterEndpointSpec(S splitter) { - super(splitter); - } - - /** - * Set the applySequence flag to the specified value. Defaults to {@code true}. - * @param applySequence the applySequence. - * @return the endpoint spec. - * @see AbstractMessageSplitter#setApplySequence(boolean) - */ - public SplitterEndpointSpec applySequence(boolean applySequence) { - this.handler.setApplySequence(applySequence); - return this; - } - - /** - * Set delimiters to tokenize String values. The default is - * null indicating that no tokenizing should occur. - * If delimiters are provided, they will be applied to any String payload. - * Only applied if provided {@code splitter} is instance of {@link DefaultMessageSplitter}. - * @param delimiters The delimiters. - * @return the endpoint spec. - * @see DefaultMessageSplitter#setDelimiters(String) - */ - public SplitterEndpointSpec delimiters(String delimiters) { - if (this.handler instanceof DefaultMessageSplitter) { - ((DefaultMessageSplitter) this.handler).setDelimiters(delimiters); - } - else { - logger.warn("'delimiters' can be applied only for the DefaultMessageSplitter"); - } - return this; - } - - /** - * Specify a channel where rejected Messages should be sent. If the discard - * channel is null (the default), rejected Messages will be dropped. - * A "Rejected Message" means that split function has returned an empty result (but not null): - * no items to iterate for sending. - * @param discardChannel The discard channel. - * @return the endpoint spec. - * @since 5.2 - * @see DefaultMessageSplitter#setDelimiters(String) - */ - public SplitterEndpointSpec discardChannel(MessageChannel discardChannel) { - this.handler.setDiscardChannel(discardChannel); - return this; - } - - /** - * Specify a channel bean name where rejected Messages should be sent. If the discard - * channel is null (the default), rejected Messages will be dropped. - * A "Rejected Message" means that split function has returned an empty result (but not null): - * no items to iterate for sending. - * @param discardChannelName The discard channel bean name. - * @return the endpoint spec. - * @since 5.2 - * @see DefaultMessageSplitter#setDelimiters(String) - */ - public SplitterEndpointSpec discardChannel(String discardChannelName) { - this.handler.setDiscardChannelName(discardChannelName); - return this; - } - - /** - * Configure a subflow to run for discarded messages instead of a - * {@link #discardChannel(MessageChannel)}. - * @param discardFlow the discard flow. - * @return the endpoint spec. - * @since 5.2 - */ - public SplitterEndpointSpec discardFlow(IntegrationFlow discardFlow) { - return discardChannel(obtainInputChannelFromFlow(discardFlow)); - } - -} diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/RequestHandlerRetryAdvice.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/RequestHandlerRetryAdvice.java index 23c14b59dd..cdf50b3baa 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/RequestHandlerRetryAdvice.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/RequestHandlerRetryAdvice.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 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. @@ -40,8 +40,7 @@ import org.springframework.util.Assert; * * @since 2.2 */ -public class RequestHandlerRetryAdvice extends AbstractRequestHandlerAdvice - implements RetryListener { +public class RequestHandlerRetryAdvice extends AbstractRequestHandlerAdvice { private static final IntegrationRetryListener INTEGRATION_RETRY_LISTENER = new IntegrationRetryListener(); @@ -98,23 +97,6 @@ public class RequestHandlerRetryAdvice extends AbstractRequestHandlerAdvice } } - /** - * Set a {@link ErrorMessageUtils#FAILED_MESSAGE_CONTEXT_KEY} attribute into context. - * @param context the current {@link RetryContext}. - * @param callback the current {@link RetryCallback}. - * @param the type of object returned by the callback - * @param the type of exception it declares may be thrown - * @return the open state. - * @deprecated since 6.2 in favor of an internal {@link RetryListener} implementation. - * The {@link RequestHandlerRetryAdvice} must not be used as a listener for external {@link RetryTemplate} - * instances. - */ - @Deprecated(since = "6.2", forRemoval = true) - @Override - public boolean open(RetryContext context, RetryCallback callback) { - return INTEGRATION_RETRY_LISTENER.open(context, callback); - } - private static class IntegrationRetryListener implements RetryListener { IntegrationRetryListener() { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/leader/LockRegistryLeaderInitiator.java b/spring-integration-core/src/main/java/org/springframework/integration/support/leader/LockRegistryLeaderInitiator.java index a20f0f9d9f..d1ac3092e5 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/leader/LockRegistryLeaderInitiator.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/support/leader/LockRegistryLeaderInitiator.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2023 the original author or authors. + * Copyright 2016-2024 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. @@ -17,7 +17,6 @@ package org.springframework.integration.support.leader; import java.util.concurrent.Callable; -import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; @@ -30,7 +29,6 @@ import org.springframework.context.SmartLifecycle; import org.springframework.core.log.LogAccessor; import org.springframework.core.task.AsyncTaskExecutor; import org.springframework.core.task.SimpleAsyncTaskExecutor; -import org.springframework.core.task.support.TaskExecutorAdapter; import org.springframework.integration.leader.Candidate; import org.springframework.integration.leader.Context; import org.springframework.integration.leader.DefaultCandidate; @@ -181,18 +179,6 @@ public class LockRegistryLeaderInitiator implements SmartLifecycle, DisposableBe this.candidate = candidate; } - /** - * Set the {@link ExecutorService}, where is not provided then a default of - * single thread Executor will be used. - * @param executorService the executor service - * @since 5.0.2 - * @deprecated since 6.2 in favor of {@link #setTaskExecutor(AsyncTaskExecutor)} - */ - @Deprecated(since = "6.2", forRemoval = true) - public void setExecutorService(ExecutorService executorService) { - setTaskExecutor(new TaskExecutorAdapter(executorService)); - } - /** * Set a {@link AsyncTaskExecutor} for running leadership daemon. * @param taskExecutor the {@link AsyncTaskExecutor} to use. diff --git a/spring-integration-core/src/main/java/org/springframework/integration/util/UUIDConverter.java b/spring-integration-core/src/main/java/org/springframework/integration/util/UUIDConverter.java index c6cabca920..344867f7bc 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/util/UUIDConverter.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/util/UUIDConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 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. @@ -36,13 +36,6 @@ import org.springframework.util.ClassUtils; */ public class UUIDConverter implements Converter { - /** - * @deprecated since 6.0.8 as it is not used internally by the UUIDConverter. - * The internal implementation relies on {@link StandardCharsets#UTF_8} instead. - */ - @Deprecated - public static final String DEFAULT_CHARSET = "UTF-8"; - private static final Pattern UUID_REGEX = Pattern.compile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/util/WhileLockedProcessor.java b/spring-integration-core/src/main/java/org/springframework/integration/util/WhileLockedProcessor.java deleted file mode 100644 index c076a0f76b..0000000000 --- a/spring-integration-core/src/main/java/org/springframework/integration/util/WhileLockedProcessor.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2002-2023 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.io.IOException; -import java.util.concurrent.locks.Lock; - -import org.springframework.integration.support.locks.LockRegistry; -import org.springframework.messaging.MessagingException; - -/** - * A simple strategy callback class that allows you to provide - * a code that needs to be executed under {@link Lock} provided by - * {@link LockRegistry}. - * A typical usage would be to provide implementation of {@link #whileLocked()} method and - * then call {@link #doWhileLocked()}. - * - * @author Oleg Zhurakousky - * @author Artem Bilan - * - * @since 2.2 - * - * @deprecated since 6.2 in favor of {@link LockRegistry#executeLocked}. - */ -@Deprecated(since = "6.2", forRemoval = true) -public abstract class WhileLockedProcessor { - - private final Object key; - - private final LockRegistry lockRegistry; - - public WhileLockedProcessor(LockRegistry lockRegistry, Object key) { - this.key = key; - this.lockRegistry = lockRegistry; - } - - public final void doWhileLocked() throws IOException { - Lock lock = this.lockRegistry.obtain(this.key); - try { - lock.lockInterruptibly(); - try { - this.whileLocked(); - } - finally { - lock.unlock(); - } - } - catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new MessagingException("Thread was interrupted while performing task", e); - } - } - - /** - * Override this method to provide the behavior that needs to be executed - * while under the lock. - * @throws IOException Any IOException. - */ - protected abstract void whileLocked() throws IOException; - -} diff --git a/spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinIntegrationFlowDefinition.kt b/spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinIntegrationFlowDefinition.kt index 696369a09c..6c5781802a 100644 --- a/spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinIntegrationFlowDefinition.kt +++ b/spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinIntegrationFlowDefinition.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-2023 the original author or authors. + * Copyright 2020-2024 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. @@ -41,7 +41,6 @@ import org.springframework.integration.router.RecipientListRouter import org.springframework.integration.scattergather.ScatterGatherHandler import org.springframework.integration.splitter.AbstractMessageSplitter import org.springframework.integration.splitter.DefaultMessageSplitter -import org.springframework.integration.splitter.ExpressionEvaluatingSplitter import org.springframework.integration.splitter.MethodInvokingSplitter import org.springframework.integration.store.MessageStore import org.springframework.integration.support.MapBuilder @@ -56,7 +55,6 @@ import org.springframework.messaging.MessageChannel import org.springframework.messaging.MessageHandler import org.springframework.messaging.MessageHeaders import org.springframework.messaging.support.ChannelInterceptor -import org.springframework.util.StringUtils import reactor.core.publisher.Flux import java.util.function.Consumer @@ -77,7 +75,7 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * with reified generic type. */ inline fun convert( - crossinline configurer: GenericEndpointSpec.() -> Unit = {} + crossinline configurer: GenericEndpointSpec.() -> Unit = {} ) { this.delegate.convert(T::class.java) { configurer(it) } @@ -91,25 +89,6 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ this.delegate.transform(P::class.java) { function(it) } } - /** - * Inline function for [IntegrationFlowDefinition.transform] providing a `transform()` variant - * with reified generic type. - */ - @Deprecated("since 6.2", - ReplaceWith(""" - transformWith { - transformer { } - id("value") - }""")) - @Suppress("DEPRECATION", "REMOVAL") - inline fun transform( - crossinline function: (P) -> Any, - crossinline configurer: GenericEndpointSpec.() -> Unit - ) { - - this.delegate.transform(P::class.java, { function(it) }) { configurer(it) } - } - /** * Populate a transformer endpoint. * @since 6.2 @@ -134,24 +113,6 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ this.delegate.register(KotlinSplitterSpec(), configurer) } - /** - * Inline function for [IntegrationFlowDefinition.split] providing a `split()` variant - * with reified generic type. - */ - @Deprecated("since 6.2", - ReplaceWith(""" - splitWith { - function {} - }""")) - @Suppress("DEPRECATION", "REMOVAL") - inline fun split( - crossinline function: (P) -> Any, - crossinline configurer: KotlinSplitterEndpointSpec.() -> Unit - ) { - - this.delegate.split(P::class.java, { function(it) }) { configurer(KotlinSplitterEndpointSpec(it)) } - } - /** * Inline function for [IntegrationFlowDefinition.filter] providing a `filter()` variant * with reified generic type. @@ -165,8 +126,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * with reified generic type. */ inline fun filter( - crossinline function: (P) -> Boolean, - crossinline filterConfigurer: KotlinFilterEndpointSpec.() -> Unit + crossinline function: (P) -> Boolean, + crossinline filterConfigurer: KotlinFilterEndpointSpec.() -> Unit ) { this.delegate.filter(P::class.java, { function(it) }) { filterConfigurer(KotlinFilterEndpointSpec(it)) } @@ -186,8 +147,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * with reified generic type. */ inline fun route( - crossinline function: (P) -> T, - crossinline configurer: KotlinRouterSpec.() -> Unit + crossinline function: (P) -> T, + crossinline configurer: KotlinRouterSpec.() -> Unit ) { this.delegate.route(P::class.java, { function(it) }) { configurer(KotlinRouterSpec(it)) } @@ -248,16 +209,16 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * method specific implementation to allow the use of the 'subflow' subscriber capability. */ fun publishSubscribe( - broadcastCapableChannel: BroadcastCapableChannel, - vararg subscribeSubFlows: KotlinIntegrationFlowDefinition.() -> Unit + broadcastCapableChannel: BroadcastCapableChannel, + vararg subscribeSubFlows: KotlinIntegrationFlowDefinition.() -> Unit ) { val publishSubscribeChannelConfigurer = - Consumer { spec -> - subscribeSubFlows.forEach { subFlow -> - spec.subscribe { subFlow(KotlinIntegrationFlowDefinition(it)) } + Consumer { spec -> + subscribeSubFlows.forEach { subFlow -> + spec.subscribe { subFlow(KotlinIntegrationFlowDefinition(it)) } + } } - } this.delegate.publishSubscribeChannel(broadcastCapableChannel, publishSubscribeChannelConfigurer) } @@ -281,8 +242,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ */ fun wireTap(wireTapConfigurer: WireTapSpec.() -> Unit, flow: KotlinIntegrationFlowDefinition.() -> Unit) { this.delegate.wireTap( - IntegrationFlow { flow(KotlinIntegrationFlowDefinition(it)) }, - Consumer(wireTapConfigurer) + IntegrationFlow { flow(KotlinIntegrationFlowDefinition(it)) }, + Consumer(wireTapConfigurer) ) } @@ -327,27 +288,6 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ this.delegate.controlBus(endpointConfigurer) } - - /** - * Populate the [Transformer] EI Pattern specific [MessageHandler] implementation - * for the provided `Transformer` instance. - * @since 5.3.1 - */ - @Deprecated("since 6.2", - ReplaceWith(""" - transformWith { - transformer(transformer) - id("value") - }""")) - @Suppress("DEPRECATION", "REMOVAL") - fun transform( - transformer: Transformer, - endpointConfigurer: GenericEndpointSpec.() -> Unit = {} - ) { - - this.delegate.transform(transformer) { endpointConfigurer(it) } - } - /** * Populate the [Transformer] EI Pattern specific [MessageHandler] implementation * for the provided [Transformer] instance. @@ -357,26 +297,6 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ this.delegate.transform(transformer) } - /** - * Populate the [Transformer] EI Pattern specific [MessageHandler] implementation - * for the SpEL [Expression]. - */ - @Deprecated("since 6.2", - ReplaceWith(""" - transformWith { - expression("value") - id("value") - }""")) - @Suppress("DEPRECATION", "REMOVAL") - fun transform( - expression: String, - endpointConfigurer: GenericEndpointSpec.() -> Unit = {} - ) { - - this.delegate.transform(expression, endpointConfigurer) - } - - /** * Populate the [Transformer] EI Pattern specific [MessageHandler] implementation * for the SpEL [Expression]. @@ -394,46 +314,6 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ this.delegate.transform(service, methodName) } - /** - * Populate the [MessageTransformingHandler] for the [MethodInvokingTransformer] - * to invoke the service method at runtime. - */ - @Deprecated("since 6.2", - ReplaceWith(""" - transformWith { - ref("value") - method("value") - id("value") - }""")) - @Suppress("DEPRECATION", "REMOVAL") - fun transform( - service: Any, methodName: String?, - endpointConfigurer: GenericEndpointSpec.() -> Unit - ) { - - this.delegate.transform(service, methodName, endpointConfigurer) - } - - /** - * Populate the [MessageTransformingHandler] instance for the - * [org.springframework.integration.handler.MessageProcessor] from provided [MessageProcessorSpec]. - * In addition, accept options for the integration endpoint using [GenericEndpointSpec]. - */ - @Deprecated("since 6.2", - ReplaceWith(""" - transformWith { - processor("value") - id("value") - }""")) - @Suppress("DEPRECATION", "REMOVAL") - fun transform( - messageProcessorSpec: MessageProcessorSpec<*>, - endpointConfigurer: GenericEndpointSpec.() -> Unit = {} - ) { - - this.delegate.transform(messageProcessorSpec, endpointConfigurer) - } - /** * Populate the [MessageTransformingHandler] instance for the * [org.springframework.integration.handler.MessageProcessor] from provided [MessageProcessorSpec]. @@ -474,8 +354,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * In addition, accept options for the integration endpoint using [KotlinFilterEndpointSpec]. */ fun filter( - messageProcessorSpec: MessageProcessorSpec<*>, - filterConfigurer: KotlinFilterEndpointSpec.() -> Unit = {} + messageProcessorSpec: MessageProcessorSpec<*>, + filterConfigurer: KotlinFilterEndpointSpec.() -> Unit = {} ) { this.delegate.filter(messageProcessorSpec) { filterConfigurer(KotlinFilterEndpointSpec(it)) } @@ -488,8 +368,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * @since 5.3.1 */ fun filter( - messageSelector: MessageSelector, - filterConfigurer: KotlinFilterEndpointSpec.() -> Unit = {} + messageSelector: MessageSelector, + filterConfigurer: KotlinFilterEndpointSpec.() -> Unit = {} ) { this.delegate.filter(Message::class.java, messageSelector) { filterConfigurer(KotlinFilterEndpointSpec(it)) } @@ -527,8 +407,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * In addition, accept options for the integration endpoint using [GenericEndpointSpec]. */ fun handle( - beanName: String, methodName: String?, - endpointConfigurer: GenericEndpointSpec.() -> Unit + beanName: String, methodName: String?, + endpointConfigurer: GenericEndpointSpec.() -> Unit ) { this.delegate.handle(beanName, methodName, endpointConfigurer) @@ -551,8 +431,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * In addition, accept options for the integration endpoint using [GenericEndpointSpec]. */ fun handle( - service: Any, methodName: String?, - endpointConfigurer: GenericEndpointSpec.() -> Unit + service: Any, methodName: String?, + endpointConfigurer: GenericEndpointSpec.() -> Unit ) { this.delegate.handle(service, methodName, endpointConfigurer) @@ -574,8 +454,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * In addition, accept options for the integration endpoint using [GenericEndpointSpec]. */ inline fun handle( - crossinline handler: (P, MessageHeaders) -> Any, - crossinline endpointConfigurer: GenericEndpointSpec.() -> Unit + crossinline handler: (P, MessageHeaders) -> Any, + crossinline endpointConfigurer: GenericEndpointSpec.() -> Unit ) { this.delegate.handle(P::class.java, { p, h -> handler(p, h) }) { endpointConfigurer(it) } @@ -586,8 +466,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * In addition, accept options for the integration endpoint using [GenericEndpointSpec]. */ fun handle( - messageProcessorSpec: MessageProcessorSpec<*>, - endpointConfigurer: GenericEndpointSpec.() -> Unit = {} + messageProcessorSpec: MessageProcessorSpec<*>, + endpointConfigurer: GenericEndpointSpec.() -> Unit = {} ) { this.delegate.handle(messageProcessorSpec, endpointConfigurer) @@ -599,8 +479,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * In addition, accept options for the integration endpoint using [GenericEndpointSpec]. */ fun handle( - messageHandlerSpec: MessageHandlerSpec<*, H>, - endpointConfigurer: GenericEndpointSpec.() -> Unit = {} + messageHandlerSpec: MessageHandlerSpec<*, H>, + endpointConfigurer: GenericEndpointSpec.() -> Unit = {} ) { this.delegate.handle(messageHandlerSpec, endpointConfigurer) @@ -620,8 +500,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * In addition, accept options for the integration endpoint using [GenericEndpointSpec]. */ fun handle( - messageHandler: (Message<*>) -> Unit, - endpointConfigurer: GenericEndpointSpec.() -> Unit + messageHandler: (Message<*>) -> Unit, + endpointConfigurer: GenericEndpointSpec.() -> Unit ) { this.delegate.handle(MessageHandler { messageHandler(it) }, endpointConfigurer) @@ -643,19 +523,6 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ this.delegate.bridge(endpointConfigurer) } - /** - * Populate a [DelayHandler] to the current integration flow position. - */ - @Deprecated("since 6.2", - ReplaceWith(""" - delay { - messageGroupId(groupId) - }""")) - @Suppress("DEPRECATION", "REMOVAL") - fun delay(groupId: String, endpointConfigurer: DelayerEndpointSpec.() -> Unit = {}) { - this.delegate.delay(groupId, endpointConfigurer) - } - /** * Populate a [DelayHandler] to the current integration flow position. * The [DelayerEndpointSpec#messageGroupId(String)] is required option. @@ -681,8 +548,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * In addition, accept options for the integration endpoint using [GenericEndpointSpec]. */ fun enrichHeaders( - headers: MapBuilder<*, String, Any>, - endpointConfigurer: GenericEndpointSpec.() -> Unit = {} + headers: MapBuilder<*, String, Any>, + endpointConfigurer: GenericEndpointSpec.() -> Unit = {} ) { this.delegate.enrichHeaders(headers, endpointConfigurer) @@ -695,8 +562,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * to be evaluated against a request [Message]. */ fun enrichHeaders( - headers: Map, - endpointConfigurer: GenericEndpointSpec.() -> Unit = {} + headers: Map, + endpointConfigurer: GenericEndpointSpec.() -> Unit = {} ) { this.delegate.enrichHeaders(headers, endpointConfigurer) @@ -723,23 +590,6 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ this.delegate.split(expression) } - /** - * Populate the [ExpressionEvaluatingSplitter] with provided SpEL expression. - */ - @Deprecated("since 6.2", - ReplaceWith(""" - splitWith { - expression() - }""")) - @Suppress("DEPRECATION", "REMOVAL") - fun split( - expression: String, - endpointConfigurer: KotlinSplitterEndpointSpec.() -> Unit = {} - ) { - - this.delegate.split(expression) { endpointConfigurer(KotlinSplitterEndpointSpec(it)) } - } - /** * Populate the [MethodInvokingSplitter] to evaluate the provided * `method` of the `service` at runtime. @@ -748,26 +598,6 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ this.delegate.split(service, methodName) } - /** - * Populate the [MethodInvokingSplitter] to evaluate the provided - * `method` of the `bean` at runtime. - * In addition, accept options for the integration endpoint using [KotlinSplitterEndpointSpec]. - */ - @Deprecated("since 6.2", - ReplaceWith(""" - splitWith { - ref() - method() - }""")) - @Suppress("DEPRECATION", "REMOVAL") - fun split( - service: Any, methodName: String?, - splitterConfigurer: KotlinSplitterEndpointSpec.() -> Unit - ) { - - this.delegate.split(service, methodName) { splitterConfigurer(KotlinSplitterEndpointSpec(it)) } - } - /** * Populate the [MethodInvokingSplitter] to evaluate the provided * `method` of the `bean` at runtime. @@ -776,107 +606,18 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ this.delegate.split(beanName, methodName) } - /** - * Populate the [MethodInvokingSplitter] to evaluate the provided - * `method` of the `bean` at runtime. - * In addition, accept options for the integration endpoint using [KotlinSplitterEndpointSpec]. - */ - @Deprecated("since 6.2", - ReplaceWith(""" - splitWith { - refName() - method() - }""")) - @Suppress("DEPRECATION", "REMOVAL") - fun split( - beanName: String, methodName: String?, - splitterConfigurer: KotlinSplitterEndpointSpec.() -> Unit - ) { - - this.delegate.split(beanName, methodName) { splitterConfigurer(KotlinSplitterEndpointSpec(it)) } - } - fun split(messageProcessorSpec: MessageProcessorSpec<*>) { this.delegate.split(messageProcessorSpec) } - /** - * Populate the [MethodInvokingSplitter] to evaluate the - * [MessageProcessor] at runtime from provided [MessageProcessorSpec]. - * In addition, accept options for the integration endpoint using [KotlinSplitterEndpointSpec]. - */ - @Deprecated("since 6.2", - ReplaceWith(""" - splitWith { - ref() - }""")) - @Suppress("DEPRECATION", "REMOVAL") - fun split( - messageProcessorSpec: MessageProcessorSpec<*>, - splitterConfigurer: KotlinSplitterEndpointSpec.() -> Unit - ) { - - this.delegate.split(messageProcessorSpec) { splitterConfigurer(KotlinSplitterEndpointSpec(it)) } - } - fun split(splitterMessageHandlerSpec: MessageHandlerSpec<*, out AbstractMessageSplitter>) { this.delegate.split(splitterMessageHandlerSpec) } - /** - * Populate the provided [AbstractMessageSplitter] to the current integration flow position. - */ - @Deprecated("since 6.2", - ReplaceWith(""" - splitWith { - ref() - }""")) - @Suppress("DEPRECATION", "REMOVAL") - fun split( - splitterMessageHandlerSpec: MessageHandlerSpec<*, S>, - splitterConfigurer: KotlinSplitterEndpointSpec.() -> Unit - ) { - - this.delegate.split(splitterMessageHandlerSpec) { splitterConfigurer(KotlinSplitterEndpointSpec(it)) } - } - fun split(splitter: AbstractMessageSplitter) { this.delegate.split(splitter) } - /** - * Populate the provided [AbstractMessageSplitter] to the current integration - * flow position. - */ - @Deprecated("since 6.2", - ReplaceWith(""" - splitWith { - ref() - }""")) - @Suppress("DEPRECATION", "REMOVAL") - fun split( - splitter: S, - splitterConfigurer: KotlinSplitterEndpointSpec.() -> Unit - ) { - - this.delegate.split(splitter) { splitterConfigurer(KotlinSplitterEndpointSpec(it)) } - } - - /** - * Provide the [HeaderFilter] to the current [IntegrationFlow]. - */ - @Deprecated("since 6.2", - ReplaceWith(""" - headerFilter { - patternMatch() - headersToRemove() - }""")) - fun headerFilter(headersToRemove: String, patternMatch: Boolean = true) { - headerFilter { - patternMatch(patternMatch) - headersToRemove(*StringUtils.delimitedListToStringArray(headersToRemove, ",", " ")) - } - } /** * Provide the [HeaderFilter] to the current [IntegrationFlow]. @@ -890,8 +631,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * [HeaderFilter]. */ fun headerFilter( - headerFilter: HeaderFilter, - endpointConfigurer: GenericEndpointSpec.() -> Unit + headerFilter: HeaderFilter, + endpointConfigurer: GenericEndpointSpec.() -> Unit ) { this.delegate.headerFilter(headerFilter, endpointConfigurer) @@ -903,8 +644,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * In addition, accept options for the integration endpoint using [GenericEndpointSpec]. */ fun claimCheckIn( - messageStore: MessageStore, - endpointConfigurer: GenericEndpointSpec.() -> Unit = {} + messageStore: MessageStore, + endpointConfigurer: GenericEndpointSpec.() -> Unit = {} ) { this.delegate.claimCheckIn(messageStore, endpointConfigurer) @@ -924,8 +665,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * In addition, accept options for the integration endpoint using [GenericEndpointSpec]. */ fun claimCheckOut( - messageStore: MessageStore, removeMessage: Boolean, - endpointConfigurer: GenericEndpointSpec.() -> Unit + messageStore: MessageStore, removeMessage: Boolean, + endpointConfigurer: GenericEndpointSpec.() -> Unit ) { this.delegate.claimCheckOut(messageStore, removeMessage, endpointConfigurer) @@ -970,8 +711,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * with provided options from [KotlinRouterSpec]. */ fun route( - beanName: String, method: String?, - routerConfigurer: KotlinRouterSpec.() -> Unit + beanName: String, method: String?, + routerConfigurer: KotlinRouterSpec.() -> Unit ) { this.delegate.route(beanName, method) { routerConfigurer(KotlinRouterSpec(it)) } @@ -990,8 +731,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * of the provided service and its method with provided options from [KotlinRouterSpec]. */ fun route( - service: Any, methodName: String?, - routerConfigurer: KotlinRouterSpec.() -> Unit + service: Any, methodName: String?, + routerConfigurer: KotlinRouterSpec.() -> Unit ) { this.delegate.route(service, methodName) { routerConfigurer(KotlinRouterSpec(it)) } @@ -1002,8 +743,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * with provided options from [KotlinRouterSpec]. */ fun route( - expression: String, - routerConfigurer: KotlinRouterSpec.() -> Unit = {} + expression: String, + routerConfigurer: KotlinRouterSpec.() -> Unit = {} ) { this.delegate.route(expression) { routerConfigurer(KotlinRouterSpec(it)) } @@ -1014,8 +755,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * from the provided [MessageProcessorSpec] with default options. */ fun route( - messageProcessorSpec: MessageProcessorSpec<*>, - routerConfigurer: KotlinRouterSpec.() -> Unit = {} + messageProcessorSpec: MessageProcessorSpec<*>, + routerConfigurer: KotlinRouterSpec.() -> Unit = {} ) { this.delegate.route(messageProcessorSpec) { routerConfigurer(KotlinRouterSpec(it)) } @@ -1032,7 +773,7 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * Populate the [ErrorMessageExceptionTypeRouter] with options from the [KotlinRouterSpec]. */ fun routeByException( - routerConfigurer: KotlinRouterSpec, ErrorMessageExceptionTypeRouter>.() -> Unit + routerConfigurer: KotlinRouterSpec, ErrorMessageExceptionTypeRouter>.() -> Unit ) { this.delegate.routeByException { routerConfigurer(KotlinRouterSpec(it)) } @@ -1095,13 +836,13 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * provided `subflow` with options from [GatewayEndpointSpec]. */ fun gateway( - endpointConfigurer: GatewayEndpointSpec.() -> Unit, - flow: KotlinIntegrationFlowDefinition.() -> Unit + endpointConfigurer: GatewayEndpointSpec.() -> Unit, + flow: KotlinIntegrationFlowDefinition.() -> Unit ) { this.delegate.gateway( - IntegrationFlow { flow(KotlinIntegrationFlowDefinition(it)) }, - Consumer(endpointConfigurer) + IntegrationFlow { flow(KotlinIntegrationFlowDefinition(it)) }, + Consumer(endpointConfigurer) ) } @@ -1246,8 +987,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * and [AggregatorSpec] for gathering function. */ fun scatterGather( - scatterChannel: MessageChannel, gatherer: AggregatorSpec.() -> Unit, - scatterGather: ScatterGatherSpec.() -> Unit + scatterChannel: MessageChannel, gatherer: AggregatorSpec.() -> Unit, + scatterGather: ScatterGatherSpec.() -> Unit ) { this.delegate.scatterGather(scatterChannel, Consumer(gatherer), Consumer(scatterGather)) @@ -1269,7 +1010,7 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ */ fun scatterGather(scatterer: KotlinRecipientListRouterSpec.() -> Unit, gatherer: AggregatorSpec.() -> Unit) { this.delegate.scatterGather(Consumer { scatterer(KotlinRecipientListRouterSpec(it)) }, - Consumer { gatherer(it) }) + Consumer { gatherer(it) }) } /** @@ -1278,12 +1019,12 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * and [AggregatorSpec] for gathering function. */ fun scatterGather( - scatterer: KotlinRecipientListRouterSpec.() -> Unit, gatherer: AggregatorSpec.() -> Unit, - scatterGather: ScatterGatherSpec.() -> Unit + scatterer: KotlinRecipientListRouterSpec.() -> Unit, gatherer: AggregatorSpec.() -> Unit, + scatterGather: ScatterGatherSpec.() -> Unit ) { this.delegate.scatterGather(Consumer { scatterer(KotlinRecipientListRouterSpec(it)) }, - Consumer { gatherer(it) }, Consumer { scatterGather(it) }) + Consumer { gatherer(it) }, Consumer { scatterGather(it) }) } /** @@ -1300,8 +1041,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * and endpoint options from [GenericEndpointSpec]. */ fun trigger( - triggerActionId: String, - endpointConfigurer: GenericEndpointSpec.() -> Unit = {} + triggerActionId: String, + endpointConfigurer: GenericEndpointSpec.() -> Unit = {} ) { this.delegate.trigger(triggerActionId, endpointConfigurer) @@ -1312,8 +1053,8 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ * and endpoint options from [GenericEndpointSpec]. */ fun trigger( - triggerAction: MessageTriggerAction, - endpointConfigurer: GenericEndpointSpec.() -> Unit = {} + triggerAction: MessageTriggerAction, + endpointConfigurer: GenericEndpointSpec.() -> Unit = {} ) { this.delegate.trigger(triggerAction, Consumer(endpointConfigurer)) diff --git a/spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinSplitterEndpointSpec.kt b/spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinSplitterEndpointSpec.kt deleted file mode 100644 index 2d86179f49..0000000000 --- a/spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinSplitterEndpointSpec.kt +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2020-2023 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.dsl - -import org.springframework.integration.splitter.AbstractMessageSplitter -import org.springframework.messaging.MessageChannel - -/** - * An [SplitterEndpointSpec] wrapped for Kotlin DSL. - * - * @property delegate the [SplitterEndpointSpec] this instance is delegating to. - * - * @author Artem Bilan - * - * @since 5.3 - */ -@Deprecated("since 6.2", ReplaceWith("KotlinSplitterSpec")) -@Suppress("REMOVAL", "DEPRECATION") -class KotlinSplitterEndpointSpec(override val delegate: SplitterEndpointSpec) - : KotlinConsumerEndpointSpec, H>(delegate) { - - fun applySequence(applySequence: Boolean) { - this.delegate.applySequence(applySequence) - } - - fun delimiters(delimiters: String) { - this.delegate.delimiters(delimiters) - } - - fun discardChannel(discardChannel: MessageChannel) { - this.delegate.discardChannel(discardChannel) - } - - fun discardChannel(discardChannelName: String) { - this.delegate.discardChannel(discardChannelName) - } - - fun discardFlow(discardFlow: KotlinIntegrationFlowDefinition.() -> Unit) { - discardFlow {definition -> discardFlow(KotlinIntegrationFlowDefinition(definition)) } - } - - fun discardFlow(discardFlow: IntegrationFlow) { - this.delegate.discardFlow(discardFlow) - } - -} diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/filters/LastModifiedFileListFilter.java b/spring-integration-file/src/main/java/org/springframework/integration/file/filters/LastModifiedFileListFilter.java index e381f46729..767d7cd2df 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/filters/LastModifiedFileListFilter.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/filters/LastModifiedFileListFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * Copyright 2015-2024 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,7 +19,6 @@ package org.springframework.integration.file.filters; import java.io.File; import java.time.Duration; import java.time.Instant; -import java.util.concurrent.TimeUnit; import java.util.function.Consumer; /** @@ -55,29 +54,6 @@ public class LastModifiedFileListFilter extends AbstractLastModifiedFileListFilt super(Duration.ofSeconds(age)); } - /** - * Set the age that files have to be before being passed by this filter. - * If {@link File#lastModified()} plus age is greater than the current time, the file - * is filtered. The resolution is seconds. - * Defaults to 60 seconds. - * @param age the age - * @param unit the timeUnit. - * @deprecated since 6.2 in favor of {@link #setAge(Duration)} - */ - @Deprecated(since = "6.2", forRemoval = true) - public void setAge(long age, TimeUnit unit) { - setAge(unit.toSeconds(age)); - } - - /** - * @return the age in seconds. - * @deprecated since 6.2 in favor of {@link #getAgeDuration()} - */ - @Deprecated(since = "6.2", forRemoval = true) - public long getAge() { - return getAgeDuration().getSeconds(); - } - @Override protected Instant getLastModified(File file) { return Instant.ofEpochSecond(file.lastModified() / ONE_SECOND); diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/tail/ApacheCommonsFileTailingMessageProducer.java b/spring-integration-file/src/main/java/org/springframework/integration/file/tail/ApacheCommonsFileTailingMessageProducer.java index ee7b0010d5..67fb839f21 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/tail/ApacheCommonsFileTailingMessageProducer.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/tail/ApacheCommonsFileTailingMessageProducer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 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. @@ -31,8 +31,7 @@ import org.apache.commons.io.input.TailerListenerAdapter; * @since 3.0 * */ -public class ApacheCommonsFileTailingMessageProducer extends FileTailingMessageProducerSupport - implements TailerListener { +public class ApacheCommonsFileTailingMessageProducer extends FileTailingMessageProducerSupport { private final TailerListener tailerListener = new IntegrationTailerListener(); @@ -106,46 +105,6 @@ public class ApacheCommonsFileTailingMessageProducer extends FileTailingMessageP this.tailer.close(); } - @Deprecated(since = "6.2", forRemoval = true) - @Override - public void init(Tailer tailer) { - tailerListenerIsDeprecatedError(); - } - - @Deprecated(since = "6.2", forRemoval = true) - @Override - public void fileNotFound() { - tailerListenerIsDeprecatedError(); - this.tailerListener.fileNotFound(); - } - - @Deprecated(since = "6.2", forRemoval = true) - @Override - public void fileRotated() { - tailerListenerIsDeprecatedError(); - this.tailerListener.fileRotated(); - } - - @Deprecated(since = "6.2", forRemoval = true) - @Override - public void handle(String line) { - tailerListenerIsDeprecatedError(); - this.tailerListener.handle(line); - } - - @Deprecated(since = "6.2", forRemoval = true) - @Override - public void handle(Exception ex) { - tailerListenerIsDeprecatedError(); - this.tailerListener.handle(ex); - } - - private void tailerListenerIsDeprecatedError() { - ApacheCommonsFileTailingMessageProducer.this.logger.error( - "The 'TailerListener' implementation on the 'ApacheCommonsFileTailingMessageProducer' " + - "is deprecated (in favor of an internal instance) for removal in the next version."); - } - private class IntegrationTailerListener extends TailerListenerAdapter { IntegrationTailerListener() { diff --git a/spring-integration-groovy/src/main/groovy/org/springframework/integration/groovy/dsl/GroovyIntegrationFlowDefinition.groovy b/spring-integration-groovy/src/main/groovy/org/springframework/integration/groovy/dsl/GroovyIntegrationFlowDefinition.groovy index 5956aeb484..dc975a36c6 100644 --- a/spring-integration-groovy/src/main/groovy/org/springframework/integration/groovy/dsl/GroovyIntegrationFlowDefinition.groovy +++ b/spring-integration-groovy/src/main/groovy/org/springframework/integration/groovy/dsl/GroovyIntegrationFlowDefinition.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 the original author or authors. + * Copyright 2022-2024 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. @@ -24,7 +24,6 @@ import org.springframework.integration.channel.BroadcastCapableChannel import org.springframework.integration.channel.interceptor.WireTap import org.springframework.integration.core.GenericHandler import org.springframework.integration.core.GenericSelector -import org.springframework.integration.core.GenericTransformer import org.springframework.integration.dsl.AggregatorSpec import org.springframework.integration.dsl.BarrierSpec import org.springframework.integration.dsl.BroadcastPublishSubscribeSpec @@ -46,7 +45,6 @@ import org.springframework.integration.dsl.RecipientListRouterSpec import org.springframework.integration.dsl.ResequencerSpec import org.springframework.integration.dsl.RouterSpec import org.springframework.integration.dsl.ScatterGatherSpec -import org.springframework.integration.dsl.SplitterEndpointSpec import org.springframework.integration.dsl.SplitterSpec import org.springframework.integration.dsl.TransformerEndpointSpec import org.springframework.integration.dsl.WireTapSpec @@ -61,12 +59,8 @@ import org.springframework.integration.router.ErrorMessageExceptionTypeRouter import org.springframework.integration.router.ExpressionEvaluatingRouter import org.springframework.integration.router.MethodInvokingRouter import org.springframework.integration.scattergather.ScatterGatherHandler -import org.springframework.integration.splitter.AbstractMessageSplitter import org.springframework.integration.splitter.DefaultMessageSplitter -import org.springframework.integration.splitter.ExpressionEvaluatingSplitter -import org.springframework.integration.splitter.MethodInvokingSplitter import org.springframework.integration.store.MessageStore -import org.springframework.integration.transformer.ExpressionEvaluatingTransformer import org.springframework.integration.transformer.HeaderFilter import org.springframework.integration.transformer.MessageTransformingHandler import org.springframework.integration.transformer.MethodInvokingTransformer @@ -74,7 +68,6 @@ import org.springframework.messaging.Message import org.springframework.messaging.MessageChannel import org.springframework.messaging.MessageHandler import org.springframework.messaging.support.ChannelInterceptor -import org.springframework.util.StringUtils import reactor.core.publisher.Flux import java.util.concurrent.Executor @@ -286,66 +279,6 @@ class GroovyIntegrationFlowDefinition { this } - /** - * Populate the {@code Transformer} EI Pattern specific {@link MessageHandler} implementation - * for the SpEL {@link org.springframework.expression.Expression}. - * @param expression the {@code Transformer} {@link org.springframework.expression.Expression}. - * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options. - * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options. - * @see org.springframework.integration.transformer.ExpressionEvaluatingTransformer - */ - @Deprecated(since = '6.2', forRemoval = true) - GroovyIntegrationFlowDefinition transform( - String expression, - @DelegatesTo(value = GenericEndpointSpec, strategy = Closure.DELEGATE_FIRST) - @ClosureParams(value = SimpleType.class, options = 'org.springframework.integration.dsl.GenericEndpointSpec') - Closure endpointConfigurer = null) { - - this.delegate.transform expression, createConfigurerIfAny(endpointConfigurer) - this - } - - /** - * Populate the {@code MessageTransformingHandler} for the - * {@link org.springframework.integration.transformer.MethodInvokingTransformer} - * to invoke the service method at runtime. - * @param service the service to use. - * @param methodName the method to invoke. - * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options. - * @deprecated since 6.2 in favor of {@link #transform(Closure)} - * @see ExpressionEvaluatingTransformer - */ - @Deprecated(since = '6.2', forRemoval = true) - GroovyIntegrationFlowDefinition transform( - Object service, String methodName = null, - @DelegatesTo(value = GenericEndpointSpec, strategy = Closure.DELEGATE_FIRST) - @ClosureParams(value = SimpleType.class, options = 'org.springframework.integration.dsl.GenericEndpointSpec') - Closure endpointConfigurer = null) { - - this.delegate.transform service, methodName, createConfigurerIfAny(endpointConfigurer) - this - } - - /** - * 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}. - * @param messageProcessorSpec the {@link MessageProcessorSpec} to use. - * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options. - * @deprecated since 6.2 in favor of {@link #transform(Closure)} - * @see MethodInvokingTransformer - */ - @Deprecated(since = '6.2', forRemoval = true) - GroovyIntegrationFlowDefinition transform( - MessageProcessorSpec messageProcessorSpec, - @DelegatesTo(value = GenericEndpointSpec, strategy = Closure.DELEGATE_FIRST) - @ClosureParams(value = SimpleType.class, options = 'org.springframework.integration.dsl.GenericEndpointSpec') - Closure endpointConfigurer = null) { - - this.delegate.transform messageProcessorSpec, createConfigurerIfAny(endpointConfigurer) - this - } - /** * Populate the {@link MessageTransformingHandler} instance for the * {@link org.springframework.integration.handler.MessageProcessor} from provided {@link MessageProcessorSpec}. @@ -382,57 +315,6 @@ class GroovyIntegrationFlowDefinition { this } - /** - * 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}. - * @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. - * @param genericTransformer the {@link GenericTransformer} to populate. - * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options. - * @param < P > the payload type - 'transform from', or {@code Message.class}. - * @param < T > the target type - 'transform to'. - * @deprecated since 6.2 in favor of {@link #transform(Closure)} - */ - @Deprecated(since = '6.2', forRemoval = true) - GroovyIntegrationFlowDefinition transform( - GenericTransformer genericTransformer, - @DelegatesTo(value = GenericEndpointSpec, strategy = Closure.DELEGATE_FIRST) - @ClosureParams(value = SimpleType.class, options = 'org.springframework.integration.dsl.GenericEndpointSpec') - Closure endpointConfigurer = null) { - - this.delegate.transform genericTransformer, createConfigurerIfAny(endpointConfigurer) - this - } - - /** - * 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}. - * @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. - * @param genericTransformer the {@link GenericTransformer} to populate. - * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options. - * @param < P > the payload type - 'transform from', or {@code Message.class}. - * @param < T > the target type - 'transform to'. - * @deprecated since 6.2 in favor of {@link #transform(Closure)} - */ - @Deprecated(since = '6.2', forRemoval = true) - GroovyIntegrationFlowDefinition transform( - Class

expectedType, - GenericTransformer genericTransformer, - @DelegatesTo(value = GenericEndpointSpec, strategy = Closure.DELEGATE_FIRST) - @ClosureParams(value = SimpleType.class, options = 'org.springframework.integration.dsl.GenericEndpointSpec') - Closure endpointConfigurer = null) { - - GenericTransformer lambdaWrapper = payload -> genericTransformer(payload) - - this.delegate.transform expectedType, lambdaWrapper, createConfigurerIfAny(endpointConfigurer) - this - } - /** * Populate a {@link org.springframework.integration.filter.MessageFilter} with * {@link org.springframework.integration.core.MessageSelector} for the provided SpEL expression. @@ -642,25 +524,6 @@ class GroovyIntegrationFlowDefinition { this } - /** - * Populate a {@link org.springframework.integration.handler.DelayHandler} to the current integration flow position. - * @param groupId the {@code groupId} for delayed messages in the - * {@link org.springframework.integration.store.MessageGroupStore}. - * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options. - * @see org.springframework.integration.dsl.DelayerEndpointSpec - * @deprecated since 6.2 in favor of {@link #delay(groovy.lang.Closure)} - */ - @Deprecated(since = "6.2", forRemoval = true) - GroovyIntegrationFlowDefinition delay( - String groupId, - @DelegatesTo(value = DelayerEndpointSpec, strategy = Closure.DELEGATE_FIRST) - @ClosureParams(value = SimpleType.class, options = 'org.springframework.integration.dsl.DelayerEndpointSpec') - Closure endpointConfigurer = null) { - - this.delegate.delay groupId, createConfigurerIfAny(endpointConfigurer) - this - } - /** * Populate a {@link org.springframework.integration.handler.DelayHandler} to the current integration flow position. * The {@link DelayerEndpointSpec#messageGroupId(String)} is required option. @@ -737,204 +600,6 @@ class GroovyIntegrationFlowDefinition { this } - /** - * Populate the {@link DefaultMessageSplitter} with provided options - * to the current integration flow position. - * Used with a Closure expression. - * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options - * and for {@link DefaultMessageSplitter}. - * @deprecated since 6.2 in favor of {@link #splitWith(groovy.lang.Closure)} - * @see SplitterEndpointSpec - */ - @Deprecated(since = '6.2', forRemoval = true) - @SuppressWarnings(['removal', 'deprecation']) - GroovyIntegrationFlowDefinition split( - @DelegatesTo(value = SplitterEndpointSpec, strategy = Closure.DELEGATE_FIRST) - @ClosureParams(value = SimpleType.class, options = 'org.springframework.integration.dsl.SplitterEndpointSpec') - Closure endpointConfigurer) { - - this.delegate.split createConfigurerIfAny(endpointConfigurer) - this - } - - /** - * 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}. - * @deprecated since 6.2 in favor of {@link #splitWith(groovy.lang.Closure)} - */ - @Deprecated(since = '6.2', forRemoval = true) - @SuppressWarnings(['removal', 'deprecation']) - GroovyIntegrationFlowDefinition split( - String expression, - @DelegatesTo(value = SplitterEndpointSpec, strategy = Closure.DELEGATE_FIRST) - @ClosureParams(value = SimpleType.class, options = 'org.springframework.integration.dsl.SplitterEndpointSpec') - Closure endpointConfigurer = null) { - - this.delegate.split expression, createConfigurerIfAny(endpointConfigurer) - this - } - - /** - * 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}. - * @param service the service to use. - * @param methodName the method to invoke. - * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options - * and for {@link MethodInvokingSplitter}. - * @deprecated since 6.2 in favor of {@link #splitWith(groovy.lang.Closure)} - */ - @Deprecated(since = '6.2', forRemoval = true) - @SuppressWarnings(['removal', 'deprecation']) - GroovyIntegrationFlowDefinition split( - Object service, String methodName = null, - @DelegatesTo(value = SplitterEndpointSpec, strategy = Closure.DELEGATE_FIRST) - @ClosureParams(value = SimpleType.class, options = 'org.springframework.integration.dsl.SplitterEndpointSpec') - Closure endpointConfigurer = null) { - - this.delegate.split service, methodName, createConfigurerIfAny(endpointConfigurer) - this - } - - /** - * 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}. - * @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 - * and for {@link MethodInvokingSplitter}. - * @see org.springframework.integration.dsl.SplitterEndpointSpec - * @deprecated since 6.2 in favor of {@link #splitWith(groovy.lang.Closure)} - */ - @Deprecated(since = '6.2', forRemoval = true) - @SuppressWarnings(['removal', 'deprecation']) - GroovyIntegrationFlowDefinition split( - String beanName, String methodName, - @DelegatesTo(value = SplitterEndpointSpec, strategy = Closure.DELEGATE_FIRST) - @ClosureParams(value = SimpleType.class, options = 'org.springframework.integration.dsl.SplitterEndpointSpec') - Closure endpointConfigurer = null) { - - this.delegate.split beanName, methodName, createConfigurerIfAny(endpointConfigurer) - this - } - - /** - * 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}. - * @param messageProcessorSpec the splitter {@link MessageProcessorSpec}. - * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options - * and for {@link MethodInvokingSplitter}. - * @deprecated since 6.2 in favor of {@link #splitWith(groovy.lang.Closure)} - */ - @Deprecated(since = '6.2', forRemoval = true) - @SuppressWarnings(['removal', 'deprecation']) - GroovyIntegrationFlowDefinition split( - MessageProcessorSpec messageProcessorSpec, - @DelegatesTo(value = SplitterEndpointSpec, strategy = Closure.DELEGATE_FIRST) - @ClosureParams(value = SimpleType.class, options = 'org.springframework.integration.dsl.SplitterEndpointSpec') - Closure endpointConfigurer = null) { - - this.delegate.split messageProcessorSpec, createConfigurerIfAny(endpointConfigurer) - this - } - - /** - * Populate the {@link MethodInvokingSplitter} to evaluate the provided - * {@link Function} at runtime. - * 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 splitter. - * Conversion to this type will be attempted, if necessary. - * @param splitter the splitter {@link Function}. - * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options. - * @param

the payload type or {@code Message.class}. - * @deprecated since 6.2 in favor of {@link #splitWith(groovy.lang.Closure)} - */ - @Deprecated(since = '6.2', forRemoval = true) - @SuppressWarnings(['removal', 'deprecation']) -

GroovyIntegrationFlowDefinition split( - Class

expectedType, Function splitter, - @DelegatesTo(value = SplitterEndpointSpec, strategy = Closure.DELEGATE_FIRST) - @ClosureParams(value = SimpleType.class, options = 'org.springframework.integration.dsl.SplitterEndpointSpec') - Closure endpointConfigurer = null) { - - Function lambdaWrapper = payload -> splitter(payload) - - this.delegate.split expectedType, lambdaWrapper, createConfigurerIfAny(endpointConfigurer) - this - } - - /** - * Populate the provided {@link AbstractMessageSplitter} to the current integration - * flow position. - * @param splitterMessageHandlerSpec the {@link MessageHandlerSpec} to populate. - * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options. - * @param the {@link AbstractMessageSplitter} - * @deprecated since 6.2 in favor of {@link #splitWith(groovy.lang.Closure)} - * @see org.springframework.integration.dsl.SplitterEndpointSpec - */ - @Deprecated(since = '6.2', forRemoval = true) - @SuppressWarnings(['removal', 'deprecation']) - GroovyIntegrationFlowDefinition split( - MessageHandlerSpec splitterMessageHandlerSpec, - @DelegatesTo(value = SplitterEndpointSpec, strategy = Closure.DELEGATE_FIRST) - @ClosureParams(value = SimpleType.class, options = 'org.springframework.integration.dsl.SplitterEndpointSpec') - Closure endpointConfigurer = null) { - - this.delegate.split splitterMessageHandlerSpec, createConfigurerIfAny(endpointConfigurer) - this - } - - /** - * Populate the provided {@link AbstractMessageSplitter} to the current integration - * flow position. - * @param splitter the {@link AbstractMessageSplitter} to populate. - * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options. - * @param the {@link AbstractMessageSplitter} - * @deprecated since 6.2 in favor of {@link #splitWith(groovy.lang.Closure)} - * @see org.springframework.integration.dsl.SplitterEndpointSpec - */ - @Deprecated(since = '6.2', forRemoval = true) - @SuppressWarnings(['removal', 'deprecation']) - GroovyIntegrationFlowDefinition split( - S splitter, - @DelegatesTo(value = SplitterEndpointSpec, strategy = Closure.DELEGATE_FIRST) - @ClosureParams(value = SimpleType.class, options = 'org.springframework.integration.dsl.SplitterEndpointSpec') - Closure endpointConfigurer = null) { - - this.delegate.split splitter, createConfigurerIfAny(endpointConfigurer) - this - } - - /** - * 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. - * @deprecated since 6.2 in favor of {@link #headerFilter(groovy.lang.Closure)} - * @see GenericEndpointSpec - */ - @Deprecated(since = "6.2", forRemoval = true) - GroovyIntegrationFlowDefinition headerFilter( - String headersToRemove, - boolean patternMatch = true, - @DelegatesTo(value = GenericEndpointSpec, strategy = Closure.DELEGATE_FIRST) - @ClosureParams(value = SimpleType.class, options = 'org.springframework.integration.dsl.GenericEndpointSpec') - Closure endpointConfigurer = null) { - - def headerFilter = new HeaderFilter(StringUtils.delimitedListToStringArray(headersToRemove, ',', ' ')) - headerFilter.patternMatch = patternMatch - - this.delegate.headerFilter headerFilter, createConfigurerIfAny(endpointConfigurer) - this - } - /** * Populate {@link HeaderFilter} based on the options from a {@link HeaderFilterSpec}. * @param endpointConfigurer the {@link Consumer} to provide {@link HeaderFilter} and its endpoint options. diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/channel/PostgresChannelMessageTableSubscriber.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/channel/PostgresChannelMessageTableSubscriber.java index d0a5cd8290..96f8ccc0f6 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/channel/PostgresChannelMessageTableSubscriber.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/channel/PostgresChannelMessageTableSubscriber.java @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 the original author or authors. + * Copyright 2022-2024 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. @@ -23,7 +23,6 @@ import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; @@ -36,7 +35,6 @@ import org.springframework.context.SmartLifecycle; import org.springframework.core.log.LogAccessor; import org.springframework.core.task.AsyncTaskExecutor; import org.springframework.core.task.SimpleAsyncTaskExecutor; -import org.springframework.core.task.support.TaskExecutorAdapter; import org.springframework.integration.jdbc.store.JdbcChannelMessageStore; import org.springframework.integration.util.UUIDConverter; import org.springframework.lang.Nullable; @@ -108,24 +106,6 @@ public final class PostgresChannelMessageTableSubscriber implements SmartLifecyc this.tablePrefix = tablePrefix; } - /** - * Define an executor to use for listening for new messages. Note that the Postgres SQL driver implements - * listening for notifications as a blocking operation which will permanently block a thread of this executor - * while running. - * @param executor The executor to use or {@code null} if an executor should be created by this class. - * @deprecated since 6.2 in favor of {@link #setTaskExecutor(AsyncTaskExecutor)} - */ - @Deprecated(since = "6.2", forRemoval = true) - public void setExecutor(ExecutorService executor) { - this.lock.lock(); - try { - setTaskExecutor(new TaskExecutorAdapter(executor)); - } - finally { - this.lock.unlock(); - } - } - /** * Provide a managed {@link AsyncTaskExecutor} for Postgres listener daemon. * @param taskExecutor the {@link AsyncTaskExecutor} to use. diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/channel/AbstractChannelMessageStoreQueryProvider.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/channel/AbstractChannelMessageStoreQueryProvider.java deleted file mode 100644 index 1219a1ae6c..0000000000 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/channel/AbstractChannelMessageStoreQueryProvider.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2002-2023 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.jdbc.store.channel; - - -/** - * @author Gunnar Hillert - * @author Artem Bilan - * @author Adama Sorho - * - * @since 2.2 - * @deprecated since 6.2 in favor of default methods in {@link ChannelMessageStoreQueryProvider} - */ -@Deprecated(since = "6.2", forRemoval = true) -public abstract class AbstractChannelMessageStoreQueryProvider implements ChannelMessageStoreQueryProvider { -} diff --git a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/KotlinScriptExecutor.java b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/KotlinScriptExecutor.java deleted file mode 100644 index 6fff32a681..0000000000 --- a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/KotlinScriptExecutor.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2019-2023 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.scripting.jsr223; - -import javax.script.Bindings; -import javax.script.ScriptEngine; -import javax.script.ScriptEngineManager; - - -/** - * An {@link AbstractScriptExecutor} for the Kotlin scripts support. - * - * @author Artem Bilan - * - * @since 5.2 - * - * @deprecated since 6.2 in favor of {@link DefaultScriptExecutor} with {@code kotlin} - * as an argument. - */ -@Deprecated(since = "6.2", forRemoval = true) -public class KotlinScriptExecutor extends AbstractScriptExecutor { - - public KotlinScriptExecutor() { - super(new ScriptEngineManager().getEngineByName("kotlin")); - } - - @Override - protected Object postProcess(Object result, ScriptEngine scriptEngine, String script, Bindings bindings) { - return result; - } - -}