From 6da994aba93b38826654dcf86440eb490eba59bc Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Thu, 12 Dec 2024 12:22:02 -0500 Subject: [PATCH] GH-2895: Mention `endpoint.setId()` in the `registration.adoc` Fixes: https://github.com/spring-projects/spring-amqp/issues/2895 Since `id` is required for the `SimpleRabbitListenerEndpoint` definition, it is better to show it in the docs sample and mention its importance. --- .../async-annotation-driven/registration.adoc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/reference/antora/modules/ROOT/pages/amqp/receiving-messages/async-annotation-driven/registration.adoc b/src/reference/antora/modules/ROOT/pages/amqp/receiving-messages/async-annotation-driven/registration.adoc index d1458af838..46db7e95b5 100644 --- a/src/reference/antora/modules/ROOT/pages/amqp/receiving-messages/async-annotation-driven/registration.adoc +++ b/src/reference/antora/modules/ROOT/pages/amqp/receiving-messages/async-annotation-driven/registration.adoc @@ -14,6 +14,7 @@ public class AppConfig implements RabbitListenerConfigurer { @Override public void configureRabbitListeners(RabbitListenerEndpointRegistrar registrar) { SimpleRabbitListenerEndpoint endpoint = new SimpleRabbitListenerEndpoint(); + endpoint.setId("someRabbitListenerEndpoint"); endpoint.setQueueNames("anotherQueue"); endpoint.setMessageListener(message -> { // processing @@ -25,5 +26,7 @@ public class AppConfig implements RabbitListenerConfigurer { In the preceding example, we used `SimpleRabbitListenerEndpoint`, which provides the actual `MessageListener` to invoke, but you could just as well build your own endpoint variant to describe a custom invocation mechanism. +NOTE: the `id` property is required for `SimpleRabbitListenerEndpoint` definition. + It should be noted that you could just as well skip the use of `@RabbitListener` altogether and register your endpoints programmatically through `RabbitListenerConfigurer`.