spring-cloud / spring-cloud/spring-cloud-stream

StreamBridge removing BindingProperties leads to wrong destination in ProvisioningProvider

Open
#3,257 2 comments 2 reactions 1 assignee View on GitHub

@olegz is already working on this.

Since Sep 7, 2026.

bug
Dominant language
Java
Stars
1.1k
Forks
646
Avg merge
2d 3h
Merged PRs (30d)
8

Description

Description
Calling StreamBridge.send() sends Messages to the BindingName instead of the configured Destination, although the Desitnation Property is set.

We have a custom ProvisioningProvider and AbstractMessageChannelBinder Implementation for JDBC. Nonetheless the Method public ProducerDestination provisionProducerDestination(String name, ProducerProperties properties) in the ProvisioningPovider Implementation should be called from the AbstractMessageChannelBinder with the Destination set by the Property spring.cloud.stream.bindings.foobar1-out-0.desitination (eg. "foobar1"). But instead it is called with foobar1-out-0, the Name of the Binding.

In the same ApplicationContext we are using StreamBridge, to send Messages to these Bindings (e.g. streamBridge.send("foobar1-out-0", data);), which then should send the message to the configured Destination set by the Property spring.cloud.stream.bindings.foobar1-out-0.desitination.

Up to Version 5.0.2 (including) this did work. Since the Version 5.0.3, the StreamBridge removes BindingProperties (cp. https://github.com/spring-cloud/spring-cloud-stream/commit/07eb699dd4980776d3902f1c9c50d765a44f99ba#diff-5e17c4149c35b951bd7e88675c6fab6589366819948092156fd0b70573f25632), which i suspect to cause the Issue.

To Reproduce
Steps to reproduce the behavior:

  1. Implement a Custom ProvisioningProvider Implementation with a fixed number of Bindings (must be greater then spring.cloud.stream.dynamicDestinations, defaults to 10). For the following Example I reduced dynamicDestinations to 2 and 2x3 Bindings (Producer and Consumer).
spring:
  cloud:
    function:
      definition: >
        foobar1Consumer;foobar2Consumer;foobar3Consumer
    stream:
      dynamic-destination-cache-size: 2
      bindings:
        foobar1-out-0:
          destination: foobar1
          producer:
            required-groups:
              - foobar1Group
        foobar1Consumer-in-0:
          # same destination as foobar1-out-0
          destination: foobar1
          group: foobar1Group
        foobar2-out-0:
          destination: foobar2
          producer:
            required-groups:
              - foobar2Group
        foobar2Consumer-in-0:
          # same destination as foobar2-out-0
          destination: foobar2
          group: foobar2Group
        foobar3-out-0:
          destination: foobar3
          producer:
            required-groups:
              - foobar3Group
        foobar3Consumer-in-0:
          # same destination as foobar3-out-0
          destination: foobar3
          group: foobar3Group

  1. Add the Consumer Implementations for Foobar1Consumer, Foobar2Consumer, Foobar3Consumer (with a simple Log statement)
  2. Call StreamBridge.send() (eg. in a Test) and assert that the Destination matches the configured Destination Value (without the '-out-0' suffix) and the Consumers receive the Message.

Version of the framework
Working Version: up to 5.0.2 (including)
Regression in Version: 5.0.3

Expected behavior
Calling the Method StreamBridge.send() with a functional Binding Name (eg. foobar1-out-0) and a configured Destination (spring.cloud.stream.bindings.foobar1-out-0.destination), in combination with a ProvisioningProvider and AbstractMessageChannelBinder Implementation should always send the Message to the configured Destination under the Binding.
The StreamBridge Implementation should not remove BindingProperties loaded by the ApplicationContext from the YAML Configuration.

Workaround

  • Setting the Property spring.cloud.stream.dynamicDestinations to a value >= the Number of Bindings under spring.cloud.stream.binding skips the removal and temporary fixes the issue. Unfortunately it comes at the price of higher Memory consumption.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.