GH-2115 Ensure outbound interceptor is not used for functional approach

Resolves #2115
This commit is contained in:
Oleg Zhurakousky
2021-02-22 15:31:54 +01:00
parent 11acb6f5fb
commit 5d9de8ad57
2 changed files with 5 additions and 8 deletions

View File

@@ -155,13 +155,10 @@ public class MessageConverterConfigurer
ConsumerProperties consumerProperties = bindingProperties.getConsumer();
if (this.isNativeEncodingNotSet(producerProperties, consumerProperties, inbound)) {
if (inbound) {
messageChannel.addInterceptor(
new InboundContentTypeEnhancingInterceptor(contentType));
messageChannel.addInterceptor(new InboundContentTypeEnhancingInterceptor(contentType));
}
else {
messageChannel.addInterceptor(
new OutboundContentTypeConvertingInterceptor(contentType,
this.compositeMessageConverter));
else if (!functional) {
messageChannel.addInterceptor(new OutboundContentTypeConvertingInterceptor(contentType, this.compositeMessageConverter));
}
}
}

View File

@@ -64,7 +64,8 @@ public class DynamicDestinationFunctionTests {
serviceProperties.getProducerProperties("fooDestination").getPartitionKeyExtractorName());
OutputDestination output = context.getBean(OutputDestination.class);
assertThat(output.receive(1000).getPayload()).isEqualTo("fooDestination".getBytes());
Object result = output.receive(1000).getPayload();
assertThat(result).isEqualTo("fooDestination");
});
}
@@ -88,7 +89,6 @@ public class DynamicDestinationFunctionTests {
@Bean
public Consumer<String> cons() {
return value -> {
System.out.println("Sending to " + value);
resolver.resolveDestination(value).send(new GenericMessage<String>(value));
};
}