New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Partition selector strategy does not use the configured partition count for multiple outbounds #2750
Comments
How do you send them to N topics? Could you provide us with a small sample application where we can see the issue? |
Hi @sobychacko I have created a sample application showing the issue: https://github.com/angelbeshirov/spring-cloud-partition-selector-issue The reactive function reads random numbers from one topic Publishing a message to
|
- When using reactive functions, partition selector strategy does not use the configured partition count for multiple outbounds. This is because we take the first configured output binding and apply it's partition counts on all the outbound reactive streams (Tuples). Addressing this issue by properly applying the correct partition handling per output binding. Resolves spring-cloud#2750
- When using reactive functions, partition selector strategy does not use the configured partition count for multiple outbounds. This is because we take the first configured output binding and apply it's partition counts on all the outbound reactive streams (Tuples). Addressing this issue by properly applying the correct partition handling per output binding. Resolves #2750
@angelbeshirov The issue is now resolved via the commit mentioned ^^. You can try the fix on the latest snapshots. |
Thanks, @sobychacko, I can confirm the issue is resolved in 4.1.0-SNAPSHOT. |
Thanks @angelbeshirov for confirming. |
Framework Version:
spring-boot: 3.0.2
spring-cloud: 2022.0.1
Issue:
We have a reactive function, which consumes messages from one topic and sends them to N topics based on some conditions. Additionally, we also have a custom key extractor and partition selector configured for each of the output bindings. However, the number of partitions of the outbound topics is different which does not seem to be reflected in the custom partition selector.
I did some digging and it seems only the binding properties of the first outbound are being used when creating the
PartitionAwareFunctionWrapper
, which are then passed to thePartitionHandler
invoking the overridenselectPartition(Object key, int partitionCount)
method with incorrect partition count.Sending the message to the incorrect partition results in
TimeoutException
.Code snippet from
org.springframework.cloud.stream.function.FunctionConfiguration
Expected behavior:
I would expect the framework to honor the configured partition count for each output binding.
The text was updated successfully, but these errors were encountered: