Fix PartitioningInterceptor CCE
The newly added DefaultPartitioningInteceptor must be explicitly checked in order to avoid a CCE. 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:
@@ -419,10 +419,14 @@ public class KafkaMessageChannelBinder extends
|
|||||||
List<ChannelInterceptor> interceptors = ((InterceptableChannel) channel)
|
List<ChannelInterceptor> interceptors = ((InterceptableChannel) channel)
|
||||||
.getInterceptors();
|
.getInterceptors();
|
||||||
interceptors.forEach((interceptor) -> {
|
interceptors.forEach((interceptor) -> {
|
||||||
if (interceptor instanceof PartitioningInterceptor || interceptor instanceof DefaultPartitioningInterceptor) {
|
if (interceptor instanceof PartitioningInterceptor) {
|
||||||
((PartitioningInterceptor) interceptor)
|
((PartitioningInterceptor) interceptor)
|
||||||
.setPartitionCount(partitions.size());
|
.setPartitionCount(partitions.size());
|
||||||
}
|
}
|
||||||
|
else if (interceptor instanceof DefaultPartitioningInterceptor) {
|
||||||
|
((DefaultPartitioningInterceptor) interceptor)
|
||||||
|
.setPartitionCount(partitions.size());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user