Skip to content
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

@SubscribeMapping doesn't match when client subscribes to /* #33087

Closed
abiri-1mrobotics opened this issue Jun 22, 2024 · 1 comment
Closed

@SubscribeMapping doesn't match when client subscribes to /* #33087

abiri-1mrobotics opened this issue Jun 22, 2024 · 1 comment
Labels
in: messaging Issues in messaging modules (jms, messaging) status: invalid An issue that we don't feel is valid

Comments

@abiri-1mrobotics
Copy link

Affects: 6.0.x

I have something similar to this:

@SubscribeMapping("/chat")
fun onSubscribeSendChat() =
    chatMessages

@SubscribeMapping("/users")
fun onSubscribeSendUsers() =
    currentUsers

I have a client that connects and subscribes to /*. My intention is for this newly connected client to receive this initial state to initialize it. However, it seems that @SubscribeMapping("/some-topic") isn't called when the client subscribes to some-topic by wildcards.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 22, 2024
@bclozel
Copy link
Member

bclozel commented Jun 24, 2024

I think this is by design. As stated in the reference documentation for @SubscribeMapping, this annotation is designed for "one-time request-reply exchange", where the client receives a one-time response to a subscription request.

In this case, matching many if not all @SubscribeMapping routes would yield an undefined behavior. How would the client differentiate the multiple responses received at once? How should we guarantee ordering? What if one of them results in an error, how should we process error handling in this case?

If you would like to send initialization data to a client at startup, I believe you should have one or more dedicated routes and reply accordingly.

I'm closing this issue as invalid as a result.

@bclozel bclozel closed this as not planned Won't fix, can't repro, duplicate, stale Jun 24, 2024
@bclozel bclozel added in: messaging Issues in messaging modules (jms, messaging) status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: messaging Issues in messaging modules (jms, messaging) status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

3 participants