Skip to content

Commit 31642a2

Browse files
committed
GH-9698: Remove deprecated AMQP tx-size attribute
Fixes: #9698 This is replaced now with a `batch-size` attribute
1 parent 8ee1a36 commit 31642a2

File tree

3 files changed

+12
-33
lines changed

3 files changed

+12
-33
lines changed

spring-integration-amqp/src/main/java/org/springframework/integration/amqp/config/AbstractAmqpInboundAdapterParser.java

Lines changed: 11 additions & 18 deletions
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.
@@ -29,6 +29,7 @@
2929
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
3030
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
3131
import org.springframework.beans.factory.xml.ParserContext;
32+
import org.springframework.beans.factory.xml.XmlReaderContext;
3233
import org.springframework.integration.amqp.support.DefaultAmqpHeaderMapper;
3334
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
3435
import org.springframework.util.Assert;
@@ -58,7 +59,6 @@ abstract class AbstractAmqpInboundAdapterParser extends AbstractSingleBeanDefini
5859
"recovery-interval",
5960
"receive-timeout",
6061
"shutdown-timeout",
61-
"tx-size",
6262
"batch-size",
6363
"missing-queues-fatal"
6464
};
@@ -108,8 +108,7 @@ protected void doParse(Element element, ParserContext parserContext, BeanDefinit
108108
}
109109
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "message-converter");
110110

111-
BeanDefinitionBuilder mapperBuilder = BeanDefinitionBuilder
112-
.genericBeanDefinition(DefaultAmqpHeaderMapper.class);
111+
BeanDefinitionBuilder mapperBuilder = BeanDefinitionBuilder.genericBeanDefinition(DefaultAmqpHeaderMapper.class);
113112
mapperBuilder.setFactoryMethod("inboundMapper");
114113
IntegrationNamespaceUtils.configureHeaderMapper(element, builder, parserContext, mapperBuilder, null);
115114

@@ -125,24 +124,24 @@ protected void doParse(Element element, ParserContext parserContext, BeanDefinit
125124
}
126125

127126
private BeanDefinition buildListenerContainer(Element element, ParserContext parserContext) {
127+
XmlReaderContext readerContext = parserContext.getReaderContext();
128128
if (!element.hasAttribute("queue-names")) {
129-
parserContext.getReaderContext().error("If no 'listener-container' reference is provided, " +
130-
"the 'queue-names' attribute is required.", element);
129+
readerContext.error(
130+
"If no 'listener-container' reference is provided, the 'queue-names' attribute is required.",
131+
element);
131132
}
132133
String consumersPerQueue = element.getAttribute("consumers-per-queue");
133134
BeanDefinitionBuilder builder;
134135
if (StringUtils.hasText(consumersPerQueue)) {
135136
builder = BeanDefinitionBuilder.genericBeanDefinition(DirectMessageListenerContainer.class);
136137
if (StringUtils.hasText(element.getAttribute("concurrent-consumers"))) {
137-
parserContext.getReaderContext().error("'consumers-per-queue' and 'concurrent-consumers' are mutually "
138-
+ "exclusive", element);
138+
readerContext.error("'consumers-per-queue' and 'concurrent-consumers' are mutually exclusive", element);
139139
}
140140
if (StringUtils.hasText(element.getAttribute("tx-size"))) {
141-
parserContext.getReaderContext().error("'tx-size' is not allowed with 'consumers-per-queue'", element);
141+
readerContext.error("'tx-size' is not allowed with 'consumers-per-queue'", element);
142142
}
143143
if (StringUtils.hasText(element.getAttribute("receive-timeout"))) {
144-
parserContext.getReaderContext().error("'receive-timeout' is not allowed with 'consumers-per-queue'",
145-
element);
144+
readerContext.error("'receive-timeout' is not allowed with 'consumers-per-queue'", element);
146145
}
147146
builder.addPropertyValue("consumersPerQueue", consumersPerQueue);
148147
}
@@ -155,13 +154,7 @@ private BeanDefinition buildListenerContainer(Element element, ParserContext par
155154
}
156155
builder.addConstructorArgReference(connectionFactoryRef);
157156
for (String attributeName : CONTAINER_VALUE_ATTRIBUTES) {
158-
// TODO remove 'tx-size' in 6.5
159-
if ("tx-size".equals(attributeName)) {
160-
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, attributeName, "batchSize");
161-
}
162-
else {
163-
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, attributeName);
164-
}
157+
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, attributeName);
165158
}
166159
for (String attributeName : CONTAINER_REFERENCE_ATTRIBUTES) {
167160
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, attributeName);

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

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,20 +1113,6 @@ standard headers to also be mapped. To map all non-standard headers the 'NON_STA
11131113
</xsd:appinfo>
11141114
</xsd:annotation>
11151115
</xsd:attribute>
1116-
<xsd:attribute name="tx-size" type="xsd:string">
1117-
<xsd:annotation>
1118-
<xsd:appinfo>
1119-
<xsd:documentation>
1120-
[DEPRECATED]
1121-
How many messages to process in a single transaction (if the channel is transactional). For best
1122-
results it should be
1123-
less than or equal to the prefetch count.
1124-
Not allowed when 'consumers-per-queue' is set.
1125-
Deprecated in favor of 'batch-size'.
1126-
</xsd:documentation>
1127-
</xsd:appinfo>
1128-
</xsd:annotation>
1129-
</xsd:attribute>
11301116
<xsd:attribute name="batch-size" type="xsd:string">
11311117
<xsd:annotation>
11321118
<xsd:appinfo>

spring-integration-amqp/src/test/java/org/springframework/integration/amqp/config/AmqpInboundChannelAdapterParserTests-context.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</util:properties>
1919

2020
<amqp:inbound-channel-adapter id="rabbitInbound" queue-names="inboundchanneladapter.test.1"
21-
batch-mode="EXTRACT_PAYLOADS" tx-size="2"/>
21+
batch-mode="EXTRACT_PAYLOADS" batch-size="2"/>
2222

2323
<amqp:inbound-channel-adapter id="autoStartFalse" queue-names="inboundchanneladapter.test.2"
2424
auto-startup="false" phase="123" acknowledge-mode="${ackMode}"

0 commit comments

Comments
 (0)