Skip to content

Commit

Permalink
GH-2895: Mention endpoint.setId() in the registration.adoc
Browse files Browse the repository at this point in the history
Fixes: #2895

Since `id` is required for the `SimpleRabbitListenerEndpoint` definition,
it is better to show it in the docs sample and mention its importance.
  • Loading branch information
artembilan committed Dec 12, 2024
1 parent b6e7235 commit 6da994a
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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`.

0 comments on commit 6da994a

Please sign in to comment.