Native endoding/decoding changes for interceptors
Fixes #1109 - Disable outbound content type interceptor when nativeEndoding is enabled on the producer - Disable inbound content type interceptor when nativeDecoding is enabled on the consumer - Add a new flag in ConsumerProperties for useNativeDecoding - Apply ContentType interceptor before the InboundInterceptor to ensure that content type set on the channel is applied on the message if content type is missing on the Message. - Add tests for verifying interceptors are not applied when native encoding/decoding is enabled - Fix a kryo integration test - Remove Inbound interceptor from MessageCollector when native encoding is enabled on the producer - Polishing
This commit is contained in:
committed by
Oleg Zhurakousky
parent
b865f3cbe9
commit
53df5f5747
@@ -50,6 +50,7 @@ import org.springframework.util.Assert;
|
||||
* @author Gary Russell
|
||||
* @author Mark Fisher
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Soby Chacko
|
||||
* @see MessageQueueMatcher
|
||||
*/
|
||||
public class TestSupportBinder implements Binder<MessageChannel, ConsumerProperties, ProducerProperties> {
|
||||
@@ -71,7 +72,7 @@ public class TestSupportBinder implements Binder<MessageChannel, ConsumerPropert
|
||||
@Override
|
||||
public Binding<MessageChannel> bindProducer(String name, MessageChannel outboundBindTarget,
|
||||
ProducerProperties properties) {
|
||||
final BlockingQueue<Message<?>> queue = messageCollector.register(outboundBindTarget);
|
||||
final BlockingQueue<Message<?>> queue = messageCollector.register(outboundBindTarget, properties.isUseNativeEncoding());
|
||||
((SubscribableChannel) outboundBindTarget).subscribe(new MessageHandler() {
|
||||
@Override
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
@@ -99,9 +100,12 @@ public class TestSupportBinder implements Binder<MessageChannel, ConsumerPropert
|
||||
|
||||
private final Map<MessageChannel, BlockingQueue<Message<?>>> results = new HashMap<>();
|
||||
|
||||
private BlockingQueue<Message<?>> register(MessageChannel channel) {
|
||||
// we need to add this intercepter to ensure MessageCollector's compatibility with previous versions of SCSt
|
||||
((AbstractMessageChannel)channel).addInterceptor(new MessageConverterConfigurer.InboundMessageConvertingInterceptor());
|
||||
private BlockingQueue<Message<?>> register(MessageChannel channel, boolean useNativeEncoding) {
|
||||
// we need to add this interceptor to ensure MessageCollector's compatibility with
|
||||
// previous versions of SCSt when native encoding is disabled.
|
||||
if (!useNativeEncoding) {
|
||||
((AbstractMessageChannel) channel).addInterceptor(new MessageConverterConfigurer.InboundMessageConvertingInterceptor());
|
||||
}
|
||||
LinkedBlockingDeque<Message<?>> result = new LinkedBlockingDeque<>();
|
||||
Assert.isTrue(!results.containsKey(channel), "Channel [" + channel + "] was already bound");
|
||||
results.put(channel, result);
|
||||
|
||||
Reference in New Issue
Block a user