-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Update Server Requesters IAW observed behavior #25032
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
Conversation
In spring-messaging-5.2.5-RELEASE, I observed in the debugger that to successfully complete the connection setup after intercepting and caching a Server Requester, the Kotlin @ConnectMapping method must declare a return type of Mono<Void>? and then return null.
Any other declared return type or a non-null return value, including Mono.empty(), caused AbstractEncoderMethodReturnValueHandler.handleReturnValue(...) to fall through to the code after this `if` block:
```
if (returnValue == null) {
return handleNoContent(returnType, message);
}
```
and that resulted in a failure to establish the connection with a RejectedSetupException.
|
@richmeyer7 Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
|
@richmeyer7 Thank you for signing the Contributor License Agreement! |
|
From the reference docs:
In other words the completion of a |
|
Thank you, Rossen.
My method is below.
It does not start a request.
It merely caches the RSocketRequester and returns. I checked that the
RSocketRequester did not get used immediately upon entering the cache.
I found that returning any value other than null caused the connection
setup to fail.
Also, declaring the method to return Unit (void) and not providing a return
value caused the connection setup to fail.
I stepped through the Spring handling in the debugger for various return
types and values, and found that the only successful path was to return
null so that method
AbstractEncoderMethodReturnValueHandler.handleReturnValue(...) executes its
"if (returnValue == null)" block and returns, not executing the remainder
of the method.
This may turn out to be unintentional behavior in
AbstractEncoderMethodReturnValueHandler.handleReturnValue(...) and become a
bug instead of a documentation issue... if I have not misunderstood
something.
private val backendServiceRsocketRequesterReplayProcessors:
ConcurrentHashMap<String, ReplayProcessor<RSocketRequester>> =
ConcurrentHashMap()
@ConnectMapping("ApiService.registerBackendService")
@MessageMapping("ApiService.registerBackendService")
suspend fun ***@***.*** name: String,
rSocketRequester: RSocketRequester): Mono<Void>? {
backendServiceRSocketRequesterReplayProcessors.computeIfAbsent(name) {
ReplayProcessor.cacheLast() }
.onNext(rSocketRequester)
return null // This is the only value I found that doesn't trigger
RejectedSetupException.
}
- Rich
…On Mon, May 11, 2020 at 11:24 PM Rossen Stoyanchev ***@***.***> wrote:
From the reference docs:
Keep in mind that @ConnectMapping methods are essentially handlers of the
SETUP frame which must be handled before requests can begin. Therefore,
requests at the very start must be decoupled from handling.
In other words the completion of a @ConnectMapping method cannot be tied
to the start of a request. Please, provide details on what does your method
look like.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#25032 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC2Z4LYS4F5GZITQUA3X2U3RRDTS5ANCNFSM4M3SU2EQ>
.
|
|
@richmeyer7, replying through email doesn't support markdown and doesn't work very well for code samples (see above). I'm pasting your sample here as best as I could extract it. private val backendServiceRsocketRequesterReplayProcessors:
ConcurrentHashMap<String, ReplayProcessor<RSocketRequester> = ConcurrentHashMap()
@ConnectMapping("ApiService.registerBackendService")
@MessageMapping("ApiService.registerBackendService")
suspend fun registerBackendService(@Payload name: String, rSocketRequester: RSocketRequester): Mono<Void> {
backendServiceRSocketRequesterReplayProcessors
.computeIfAbsent(name) { ReplayProcessor.cacheLast() }
.onNext(rSocketRequester)
return null // This is the only value I found that doesn't trigger RejectedSetupException.
}I don't know if having both That aside the method works without a return value if |
|
If you want to translate a Reactive method that returns |
|
@rstoyanchev - I had the I used a I retested without the With Perhaps instead of my requested documentation change, the @sdeleuze - |
|
@richmeyer7 I'm sorry but I can't reproduce the issue. Please provide a sample if you'd like us to continue to look into this. |
In spring-messaging-5.2.5-RELEASE, I observed in the debugger that to successfully complete the connection setup after intercepting and caching a Server Requester, the Kotlin @ConnectMapping method must declare a return type of Mono? and then return null.
Any other declared return type or a non-null return value, including Mono.empty(), caused AbstractEncoderMethodReturnValueHandler.handleReturnValue(...) to fall through to the code after this
ifblock:and that resulted in a failure to establish the connection with a RejectedSetupException.