Skip to content

Commit d9f21fe

Browse files
committed
GH-9683: Bring back controlBus() API
Fixes: #9683 Since we don't support SpEL-based Control Bus functionality anymore, there is no need to keep separate `controlBusOnRegistry()` * In all DSLs Deprecate `controlBusOnRegistry()` and restore `controlBus()` which is now fully based on the `ControlBusCommandRegistry` * Deprecate now out of use `<control-bus use-registry="">` attribute * Fix `ControlBusParser` to not deal with `use-registry` attribute anymore * Remove deprecated before `ExpressionControlBusFactoryBean` and `ExpressionCommandMessageProcessor` * Remove `use-registry` from test configs * Fix `ControlBusChainTests` to rely on a new Control Bus functionality
1 parent 37664fb commit d9f21fe

File tree

24 files changed

+54
-284
lines changed

24 files changed

+54
-284
lines changed

spring-integration-core/src/main/java/org/springframework/integration/config/ExpressionControlBusFactoryBean.java

-59
This file was deleted.

spring-integration-core/src/main/java/org/springframework/integration/config/xml/ControlBusParser.java

+1-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -32,18 +32,8 @@
3232
public class ControlBusParser extends AbstractConsumerEndpointParser {
3333

3434
@Override
35-
@SuppressWarnings("removal")
3635
protected BeanDefinitionBuilder parseHandler(Element element, ParserContext parserContext) {
3736
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(ControlBusFactoryBean.class);
38-
if (Boolean.FALSE.equals(Boolean.parseBoolean(element.getAttribute("use-registry")))) {
39-
builder = BeanDefinitionBuilder.genericBeanDefinition(
40-
org.springframework.integration.config.ExpressionControlBusFactoryBean.class);
41-
parserContext.getReaderContext()
42-
.warning("The 'ExpressionControlBusFactoryBean' for '<control-bus>' is deprecated (for removal) " +
43-
"in favor of 'ControlBusFactoryBean'. " +
44-
"Set 'use-registry' attribute to 'true' to switch to a new functionality.",
45-
element);
46-
}
4737
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "send-timeout");
4838
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "order");
4939
return builder;

spring-integration-core/src/main/java/org/springframework/integration/dsl/BaseIntegrationFlowDefinition.java

+8-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2024 the original author or authors.
2+
* Copyright 2019-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -518,10 +518,12 @@ public B wireTap(WireTapSpec wireTapSpec) {
518518
* at the current {@link IntegrationFlow} chain position.
519519
* @return the current {@link BaseIntegrationFlowDefinition}.
520520
* @since 6.4
521+
* @deprecated since 6.5 in favor of {@link #controlBus()}
521522
* @see ControlBusMessageProcessor
522523
*/
524+
@Deprecated(since = "6.5", forRemoval = true)
523525
public B controlBusOnRegistry() {
524-
return controlBusOnRegistry(null);
526+
return controlBus();
525527
}
526528

527529
/**
@@ -530,20 +532,20 @@ public B controlBusOnRegistry() {
530532
* @param endpointConfigurer the {@link Consumer} to accept integration endpoint options.
531533
* @return the current {@link BaseIntegrationFlowDefinition}.
532534
* @since 6.4
535+
* @deprecated since 6.5 in favor of {@link #controlBus(Consumer)}
533536
* @see GenericEndpointSpec
534537
* @see ControlBusMessageProcessor
535538
*/
539+
@Deprecated(since = "6.5", forRemoval = true)
536540
public B controlBusOnRegistry(@Nullable Consumer<GenericEndpointSpec<ServiceActivatingHandler>> endpointConfigurer) {
537-
return handle(new ServiceActivatingHandler(new ControlBusMessageProcessor()), endpointConfigurer);
541+
return controlBus(endpointConfigurer);
538542
}
539543

540544
/**
541545
* Populate the {@code Control Bus} EI Pattern specific {@link MessageHandler} implementation
542546
* at the current {@link IntegrationFlow} chain position.
543547
* @return the current {@link BaseIntegrationFlowDefinition}.
544-
* @deprecated in favor of {@link #controlBusOnRegistry()} - will be restored in next version.
545548
*/
546-
@Deprecated(since = "6.4")
547549
public B controlBus() {
548550
return controlBus(null);
549551
}
@@ -553,15 +555,10 @@ public B controlBus() {
553555
* at the current {@link IntegrationFlow} chain position.
554556
* @param endpointConfigurer the {@link Consumer} to accept integration endpoint options.
555557
* @return the current {@link BaseIntegrationFlowDefinition}.
556-
* @deprecated in favor of {@link #controlBusOnRegistry(Consumer)} - will be restored in next version.
557558
* @see GenericEndpointSpec
558559
*/
559-
@Deprecated(since = "6.4")
560-
@SuppressWarnings("removal")
561560
public B controlBus(@Nullable Consumer<GenericEndpointSpec<ServiceActivatingHandler>> endpointConfigurer) {
562-
return handle(new ServiceActivatingHandler(
563-
new org.springframework.integration.handler.ExpressionCommandMessageProcessor(
564-
new org.springframework.integration.expression.ControlBusMethodFilter())), endpointConfigurer);
561+
return handle(new ServiceActivatingHandler(new ControlBusMessageProcessor()), endpointConfigurer);
565562
}
566563

567564
/**

spring-integration-core/src/main/java/org/springframework/integration/handler/ExpressionCommandMessageProcessor.java

-150
This file was deleted.

spring-integration-core/src/main/kotlin/org/springframework/integration/dsl/KotlinIntegrationFlowDefinition.kt

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2024 the original author or authors.
2+
* Copyright 2020-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -285,17 +285,15 @@ class KotlinIntegrationFlowDefinition(@PublishedApi internal val delegate: Integ
285285
* at the current [IntegrationFlow] chain position.
286286
* @since 6.4
287287
*/
288+
@Deprecated("Use 'controlBus()' instead.", replaceWith = ReplaceWith("controlBus()"))
288289
fun controlBusOnRegistry(endpointConfigurer: GenericEndpointSpec<ServiceActivatingHandler>.() -> Unit = {}) {
289-
this.delegate.controlBusOnRegistry(endpointConfigurer)
290+
controlBus(endpointConfigurer)
290291
}
291292

292293
/**
293294
* Populate the `Control Bus` EI Pattern specific [MessageHandler] implementation
294295
* at the current [IntegrationFlow] chain position.
295296
*/
296-
@Deprecated("Use 'controlBusOnRegistry()' instead.",
297-
replaceWith = ReplaceWith("controlBusOnRegistry()"))
298-
@Suppress("DEPRECATION", "REMOVAL")
299297
fun controlBus(endpointConfigurer: GenericEndpointSpec<ServiceActivatingHandler>.() -> Unit = {}) {
300298
this.delegate.controlBus(endpointConfigurer)
301299
}

spring-integration-core/src/main/resources/org/springframework/integration/config/spring-integration.xsd

+4-5
Original file line numberDiff line numberDiff line change
@@ -4978,13 +4978,12 @@ The list of component name patterns you want to track (e.g., tracked-components
49784978
]]></xsd:documentation>
49794979
</xsd:annotation>
49804980
<xsd:attribute name="id" type="xsd:string"/>
4981-
<xsd:attribute name="use-registry" type="xsd:boolean" default="false">
4981+
<xsd:attribute name="use-registry" type="xsd:boolean">
49824982
<xsd:annotation>
49834983
<xsd:documentation>
4984-
Set true to make Control Bus based on the global 'ControlBusCommandRegistry'
4985-
which is a recommended way to configure Control Bus functionality.
4986-
The false is by default for backward compatibility and is deprecated.
4987-
This attribute will be true by default in the next major version and removed altogether eventually.
4984+
[DEPRECATED]
4985+
The attribute is out of use since 6.5 and 'ControlBusCommandRegistry' is always configured.
4986+
Will be removed in the next version.
49884987
</xsd:documentation>
49894988
</xsd:annotation>
49904989
</xsd:attribute>

spring-integration-core/src/test/java/org/springframework/integration/config/AggregatorWithMessageStoreParserTests-context.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020
<beans:bean id="aggregatorBean"
2121
class="org.springframework.integration.config.TestAggregatorBean" />
2222

23-
<control-bus input-channel="controlBusChannel" output-channel="nullChannel" use-registry="true"/>
23+
<control-bus input-channel="controlBusChannel" output-channel="nullChannel"/>
2424

2525
</beans:beans>

spring-integration-core/src/test/java/org/springframework/integration/config/xml/ControlBusChainTests-context.xml

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<beans:beans xmlns="http://www.springframework.org/schema/integration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xmlns:beans="http://www.springframework.org/schema/beans" xmlns:groovy="http://www.springframework.org/schema/integration/groovy"
4-
xsi:schemaLocation="http://www.springframework.org/schema/integration
2+
<beans:beans xmlns="http://www.springframework.org/schema/integration"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:beans="http://www.springframework.org/schema/beans"
5+
xsi:schemaLocation="http://www.springframework.org/schema/integration
56
https://www.springframework.org/schema/integration/spring-integration.xsd
67
http://www.springframework.org/schema/beans
78
https://www.springframework.org/schema/beans/spring-beans.xsd">
@@ -14,6 +15,6 @@
1415
<control-bus/>
1516
</chain>
1617

17-
<beans:bean id="service" class="org.springframework.integration.config.xml.ControlBusChainTests$Service" />
18+
<beans:bean id="service" class="org.springframework.integration.config.xml.ControlBusChainTests$Service"/>
1819

1920
</beans:beans>

0 commit comments

Comments
 (0)