GH-2151 Document ProducerMessageHandlerCustomizer

Resolves #2151
This commit is contained in:
Oleg Zhurakousky
2021-06-29 12:00:24 +02:00
parent 8c88cf14d8
commit 89e09afa74

View File

@@ -2454,6 +2454,35 @@ When set to true, if the binder supports asynchroous send results, send failures
+
Default: false.
==== Advanced Producer Configuration
In some cases Producer Properties are not enough to properly configure a producing MessageHandler in the binder, or may be you prefer a programmatic approach
while configuring such producing MessageHandler. Regardless of the reason, spring-cloud-stream provides `ProducerMessageHandlerCustomizer` to accomplish it.
====
[source, java]
----
@FunctionalInterface
public interface ProducerMessageHandlerCustomizer<H extends MessageHandler> {
/**
* Configure a {@link MessageHandler} that is being created by the binder for the
* provided destination name.
* @param handler the {@link MessageHandler} from the binder.
* @param destinationName the bound destination name.
*/
void configure(H handler, String destinationName);
}
----
As you can see it gives you access to an actual instance of producing` MessageHandler` which you can configure as you wish.
All you need to do is provide implementation of this strategy and configure it as a `@Bean`.
====
[[content-type-management]]
== Content Type Negotiation