From 434a846ca728d102ca009af7cb5664be1e02d4d8 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Mon, 28 Apr 2025 15:20:31 +0200 Subject: [PATCH] GH-3106 Add documentation describing why StreamBridge does not cache bindings Resolves #3106 --- .../modules/ROOT/pages/spring-cloud-stream/event-routing.adoc | 2 +- .../spring-cloud-stream/producing-and-consuming-messages.adoc | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/modules/ROOT/pages/spring-cloud-stream/event-routing.adoc b/docs/modules/ROOT/pages/spring-cloud-stream/event-routing.adoc index 1ff6dda54..a31e7be90 100644 --- a/docs/modules/ROOT/pages/spring-cloud-stream/event-routing.adoc +++ b/docs/modules/ROOT/pages/spring-cloud-stream/event-routing.adoc @@ -166,5 +166,5 @@ public NewDestinationBindingCallback dynamicConfigurer NOTE: If you need to support dynamic destinations with multiple binder types, use `Object` for the generic type and cast the `extended` argument as needed. -Also, please see <> section to see how yet another option (StreamBridge) can be utilized for similar cases. +Also, please see xref:spring-cloud-stream/producing-and-consuming-messages.adoc#sending-arbitrary-data-to-an-output-e-g-foreign-event-driven-sources[Using StreamBridge] section to see how yet another option can be utilized for similar cases. diff --git a/docs/modules/ROOT/pages/spring-cloud-stream/producing-and-consuming-messages.adoc b/docs/modules/ROOT/pages/spring-cloud-stream/producing-and-consuming-messages.adoc index edb03d548..1233cb88a 100644 --- a/docs/modules/ROOT/pages/spring-cloud-stream/producing-and-consuming-messages.adoc +++ b/docs/modules/ROOT/pages/spring-cloud-stream/producing-and-consuming-messages.adoc @@ -293,6 +293,10 @@ Also, note that `streamBridge.send(..)` method takes an `Object` for data. This will go through the same routine when sending output as if it was from any Function or Supplier providing the same level of consistency as with functions. This means the output type conversion, partitioning etc are honored as if it was from the output produced by functions. +IMPORTANT: Unlike it is explained in xref:spring-cloud-stream/explicit-binding-creation.adoc[Explicit Binding Creation], _StreamBridge_ was designed with both performance in mind and ability to create as many bindings on the fly as necessary. To achieve that the actual bindings created by the _StreamBridge_ are not cached in the application context and therefore can not be managed as explained in xref:spring-cloud-stream/binding_visualization_control.html[Binding visualization and control]. +However if it is still your desire to use _StreamBridge_ to create bindings dynamically and manage them after, please use the following mechanism to create binding explicitly before using _StreamBridge_ - ref:spring-cloud-stream/binding_visualization_control.adocl#_define_new_and_manage_existing_bindings[Define New Binding Programmatically] + + ==== StreamBridge with async send