Skip to content

Commit 82d83b1

Browse files
committed
fix(int-aws-support): SqsOutboundChannelAdapterParser sync attribute
1 parent 78e41fc commit 82d83b1

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
package org.springframework.integration.aws.support.config.xml.parsers;
22

3-
import org.springframework.beans.factory.config.TypedStringValue;
43
import org.springframework.beans.factory.support.AbstractBeanDefinition;
54
import org.springframework.beans.factory.xml.ParserContext;
5+
import org.springframework.integration.aws.config.xml.ValueFactory;
66
import org.springframework.integration.aws.config.xml.XmlBeanDefinitionBuilder;
77
import org.springframework.integration.aws.outbound.SqsMessageHandler;
8+
import org.springframework.integration.aws.support.config.xml.InvertedBooleanFactoryBean;
89
import org.springframework.integration.config.xml.AbstractOutboundChannelAdapterParser;
910
import org.w3c.dom.Element;
1011

1112
public class SqsOutboundChannelAdapterParser extends AbstractOutboundChannelAdapterParser {
1213

1314
@Override
1415
protected AbstractBeanDefinition parseConsumer(Element element, ParserContext parserContext) {
15-
var builder = XmlBeanDefinitionBuilder.newInstance(element, parserContext, SqsMessageHandler.class)
16+
return XmlBeanDefinitionBuilder.newInstance(element, parserContext, SqsMessageHandler.class)
1617
.unsupportedAttributeWarning("failure-channel", "resource-id-resolver", "error-message-strategy", "async-handler")
1718
.addConstructorArgReference("sqs")
1819
.setPropertyOrExpressionStringIfAttributeDefined("queue")
@@ -22,19 +23,7 @@ protected AbstractBeanDefinition parseConsumer(Element element, ParserContext pa
2223
.setPropertyOrExpressionStringIfAttributeDefined("send-timeout")
2324
.setPropertyReferenceIfAttributeDefined("message-converter")
2425
.setPropertyIfAttributeDefined("success-channel", "outputChannelName")
25-
;
26-
27-
if (element.hasAttribute("sync")) {
28-
var sync = element.getAttribute("sync");
29-
if ("true".equalsIgnoreCase(sync)) {
30-
builder.getBeanDefinitionBuilder().addPropertyValue("async", new TypedStringValue("false"));
31-
} else if ("false".equalsIgnoreCase(sync)) {
32-
builder.getBeanDefinitionBuilder().addPropertyValue("async", new TypedStringValue("true"));
33-
} else {
34-
builder.error("expected boolean for 'sync' attribute");
35-
}
36-
}
37-
38-
return builder.build();
26+
.setPropertyIfAttributeDefined("sync", "async", ValueFactory.bean(InvertedBooleanFactoryBean.class))
27+
.build();
3928
}
4029
}

int-aws-support/src/test/java/org/springframework/integration/aws/support/config/xml/parsers/SqsOutboundChannelAdapterParserTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void testMessageHandler() {
3131
id="soca"
3232
channel="c"
3333
sqs="sqs"
34-
sync="false"
34+
sync="#{false}"
3535
message-converter="mc"
3636
error-message-strategy="ems"
3737
success-channel="sc"

0 commit comments

Comments
 (0)