From 043d51b3a8ceaeb92937328fbaa8df9deb75c715 Mon Sep 17 00:00:00 2001 From: Jasin Atipi Date: Mon, 22 Sep 2025 12:26:48 +0200 Subject: [PATCH] Update documenting-producers.md Specify that @Payload is needed when multiple parameter methods are annotated with @AsyncPublisher --- docs/configuration/documenting-producers.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/configuration/documenting-producers.md b/docs/configuration/documenting-producers.md index e61332e..36673ee 100644 --- a/docs/configuration/documenting-producers.md +++ b/docs/configuration/documenting-producers.md @@ -18,7 +18,8 @@ Additional fields can be documented. On the same method, the protocol binding is defined. More details can be found in the [bindings](documenting-bindings.md) section. -Below is an example to demonstrate the annotation: +### Single parameter +Below is an example to demonstrate the annotation with a single parameter method: ```java @AsyncPublisher(operation = @AsyncOperation( @@ -31,6 +32,23 @@ public void sendMessage(ExamplePayloadDto msg) { // process } ``` +### Multiple parameters +The `@Payload` annotation is necessary for methods with multiple parameters, indicating which parameter is the payload. If this annotation is missing when multiple parameters are present, the Publisher will not be documented. + +The annotation is available by importing the `spring-messaging` library. + +Here's an example: +```java +@AsyncPublisher(operation = @AsyncOperation( + channelName = "example-producer-topic", + description = "Customer uploaded an example payload", // Optional + servers = {"kafka-server"} // Optional +)) +@KafkaAsyncOperationBinding +public void sendMessage(@Payload ExamplePayloadDto msg, String otherParam) { + // process +} +``` :::note Springwolf only finds methods that are within the `base-package`.