GH-2245 StreamBridge partitioning fix
Fix the order in applying partitioning interceptor in StreamBridge. The interceptor must be added before the call for binding the producer. Related to resolving https://github.com/spring-cloud/spring-cloud-stream/issues/2245 Specifically for this: https://github.com/spring-cloud/spring-cloud-stream/issues/2245#issuecomment-977663452
This commit is contained in:
committed by
Oleg Zhurakousky
parent
3f84027b4b
commit
e7b5e59e07
@@ -271,14 +271,15 @@ public final class StreamBridge implements SmartInitializingSingleton {
|
||||
binder = binderFactory.getBinder(binderName, messageChannel.getClass());
|
||||
}
|
||||
|
||||
this.bindingService.bindProducer(messageChannel, destinationName, false, binder);
|
||||
this.channelCache.put(destinationName, messageChannel);
|
||||
if (producerProperties.isPartitioned()) {
|
||||
BindingProperties bindingProperties = this.bindingServiceProperties.getBindingProperties(destinationName);
|
||||
((AbstractMessageChannel) messageChannel)
|
||||
.addInterceptor(new DefaultPartitioningInterceptor(bindingProperties, this.applicationContext.getBeanFactory()));
|
||||
}
|
||||
this.addInterceptors((AbstractMessageChannel) messageChannel, destinationName);
|
||||
|
||||
this.bindingService.bindProducer(messageChannel, destinationName, false, binder);
|
||||
this.channelCache.put(destinationName, messageChannel);
|
||||
}
|
||||
|
||||
return messageChannel;
|
||||
|
||||
Reference in New Issue
Block a user