spring-cloud / spring-cloud/spring-cloud-stream
StreamBridge does not allow to switch between different producer configs due to internal caching
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 646
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 8
Description
We found the following potential problem while experimenting with different producer configurations - some with partitionKeyExpression and other without.
StreamBridge uses internal function cache:
private final Map<String, FunctionInvocationWrapper> streamBridgeFunctionCache;
This function cache is often overwriten (not used), if a producer configuration "isPartitioned":
Function functionToInvoke = this.getStreamBridgeFunction(outputContentType.toString(), producerProperties);
if (producerProperties != null && producerProperties.isPartitioned())
{ functionToInvoke = new PartitionAwareFunctionWrapper(functionToInvoke, this.applicationContext, producerProperties);}
With this implementation it is not possible to use different producer configurations e.g. which are not partitioned at the same time.
The cache should be removed or the key to the cache should be the name of the producer config.
This is no urgent issue for at the moment.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the StreamBridge implementation and inspect streamBridgeFunctionCache, getStreamBridgeFunction, and the PartitionAwareFunctionWrapper path. Reproduce the issue with simultaneous partitioned and non-partitioned producer configurations. Done means different producer configurations can be switched between and used without the internal cache causing one configuration to overwrite another.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend, stream-processing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100