-
Notifications
You must be signed in to change notification settings - Fork 632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add convenient getter for stream name #2961
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: David Horak <[email protected]>
artembilan
requested changes
Feb 10, 2025
* Get a name of stream this listener listens to. | ||
*/ | ||
public String getStreamName() { | ||
return streamName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must be with this.
.
Also add @since 3.2.3
to this method JavaDocs and your name to the @author
list.
Thanks.
Signed-off-by: David Horak <[email protected]>
artembilan
reviewed
Feb 10, 2025
...stream/src/main/java/org/springframework/rabbit/stream/listener/StreamListenerContainer.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Artem Bilan <[email protected]>
@unbearables , |
artembilan
pushed a commit
that referenced
this pull request
Feb 10, 2025
It would be nice to have `StreamListenerContainer.getStreamName()` method to fulfill need to dynamically stop/start listeners in reaction of broker events. Let's say I need to react to RabbitMQ broker events of queue.created / queue.deleted and I need to start and stop listeners, which are assigned to these streams. Currently I need to create an extra map of `listenerId` to `streamName` OR include `streamName` in `listenerId` (e.g. `listener:{streamName}`) to be able to carry our operations on listener. A simple getter for `streamName` on the `StreamListenerContainer` would allow me to react to these changes dynamically without extra code effort. Signed-off-by: David Horak <[email protected]> [[email protected]: Fix JavaDoc for a new method. Fix Commit message] Fixes: #2961 Signed-off-by: Artem Bilan <[email protected]> # Conflicts: # spring-rabbit-stream/src/main/java/org/springframework/rabbit/stream/listener/StreamListenerContainer.java
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It would be nice to have
StreamListenerContainer.getStreamName()
method to fulfill need to dynamically stop/start listeners in reaction of broker events.Let's say I need to react to RabbitMQ broker events of
queue.created
/queue.deleted
(see ~ name of queue is sent in event) and I need to start and stop listeners, which are assigned to these streams. Currently I need to create an extra map oflistenerId
tostreamName
OR include streamName inlistenerId
(e.g.listener:{streamName}
) to be able to carry our operations on listener.A simple getter for
streamName
onStreamListenerContainer
would allow me to react to these changes dynamically without extra code effort.An concise example with
BrokerEventListener
: