You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So we will have an initial payload and not just an inputstream, as almost all real world us cases need an initial payload to do setup, routing, determine the handler, etc.
The java RSockets are now composable - that wasn't true before when we had a request handler class. Everything in the Java version is an RSocket and we were able to get rid of handler class.
The Java requestChannel has always worked the same way. The payload in the method signature was always the first payload in the stream. All we did is remove the 'convenience' field so we don't need a handler, and made RSockets composable. If you are doing something different like the first payload that comes in is not the first payload in the stream then you changed the way the spec works, or interrupted it differently.
@robertroeser Which spec are you talking about here? rsocket says this:
REQUEST_CHANNEL
...
Request Data: identification of the service being requested along with parameters for the request.
This seems pretty clear to me, the data in the REQUEST_CHANNEL is distinct from the channel itself, and should be specified separately, which is what @phoad proposes here.
@lexs If that's what you see than it's not clear, because Request Data description is the same thing fire/forget, requestChannel, requestStream, and request/Reply
I literally remember Ben adding that payload there because its hard to pull the first payload out of an observable and then add it back into the stream and process it - thus the payload outside the stream - which is identical to the first payload in the stream. It is not a special setup payload, and if that is the way CPP implements its either wrong or the spec has changed.
Are you saying that the payload in the REQUEST_CHANNEL frame is identical to the first PAYLOAD? That's extremely confusing and makes it quite hard to do any routing for different REQUEST_CHANNELs. Also seems exactly opposite of what the spec says (see the above comment).
@lexs Please look at the frames below included in this post - they all have the same message. There is no 'setup' payload.
Are you saying that the payload in the REQUEST_CHANNEL frame is identical to the first PAYLOAD?
No - in the method signature requestChannel(Payload payload, Publisher publisher) the payload there is the same as the first item emitted from publisher. It was done that way so it was easier to route (like you pointed out). We removed this, and wrote SwitchTransform to do this instead.
We think this is a better API then CPP version / old Java version because the client and server are now symmetric, and everything can implement as RSockets which are composable. You have one abstraction for everything with the same behavior. For instance you can use the
SpectatorRSocket socket https://github.com/rsocket/rsocket-java/blob/1.0.x/rsocket-spectator/src/main/java/io/rsocket/spectator/SpectatorRSocket.java
on both the client and the server - you don't have to have a special RequestHandler, and another one for the client.
In rsocket-cpp the first emitted item was never the same as the request data payload. This is where my confusion stems from.
I find it fairly confusing that the first item of a channel would have a completely different type than the rest, as the first payload (the request data) is the request params. I much rather keep the old API (and not having the first emitted payload be the payload that is part of the REQUEST_CHANNEL frame.
I'm not following why this makes it harder to be symmetric, the RSocket class would still exist, the contract is still the same on either side. requestData is the data in the REQUEST_CHANNEL and is not duplicated in any stream.
@robertroeser, I'm trying to understand the argument about client and server symmetry. If there was Payload setup argument on requestChannel wouldn't that be used on both sides? The requester for sending the setup, and the responder for processing the setup.
To achieve this currently, one has to use SwitchTransform on the responder side, and attach metadata to the first item in the requester Flux, which amounts to the same but requires more effort.
Activity
robertroeser commentedon Feb 20, 2018
This isn't necessary. Unless things has changed the payload in the requestChannel method signature was same as the first channel in the stream. This was removed on purpose. RSocket have an operator called SwitchTransform that you can use to switch on the payload for routing. We do this in Proteus in the RequestHandlingRSocket: https://github.com/netifi-proteus/proteus-java/blob/master/core/src/main/java/io/netifi/proteus/rs/RequestHandlingRSocket.java#L100
The java RSockets are now composable - that wasn't true before when we had a request handler class. Everything in the Java version is an RSocket and we were able to get rid of handler class.
yschimke commentedon Feb 20, 2018
My concern here is two teams building two different semantics for the same operations.
cpp - setup frame, pushed initially on connection, received before any subscription etc.
java - first frame is the first in the stream.
They may be mappable to each other, but they are confusingly different models. IMHO.
robertroeser commentedon Feb 20, 2018
The Java requestChannel has always worked the same way. The payload in the method signature was always the first payload in the stream. All we did is remove the 'convenience' field so we don't need a handler, and made RSockets composable. If you are doing something different like the first payload that comes in is not the first payload in the stream then you changed the way the spec works, or interrupted it differently.
robertroeser commentedon Feb 20, 2018
Looks like the first payload in CPP is in a publisher
https://github.com/rsocket/rsocket-cpp/blob/master/rsocket/RSocketRequester.cpp#L35
And then exposed twice like the old java version
https://github.com/rsocket/rsocket-cpp/blob/master/rsocket/RSocketResponder.cpp#L22
lexs commentedon Feb 20, 2018
@robertroeser Which spec are you talking about here? rsocket says this:
This seems pretty clear to me, the data in the REQUEST_CHANNEL is distinct from the channel itself, and should be specified separately, which is what @phoad proposes here.
robertroeser commentedon Feb 21, 2018
@lexs If that's what you see than it's not clear, because Request Data description is the same thing fire/forget, requestChannel, requestStream, and request/Reply
I literally remember Ben adding that payload there because its hard to pull the first payload out of an observable and then add it back into the stream and process it - thus the payload outside the stream - which is identical to the first payload in the stream. It is not a special setup payload, and if that is the way CPP implements its either wrong or the spec has changed.
lexs commentedon Feb 21, 2018
Are you saying that the payload in the REQUEST_CHANNEL frame is identical to the first PAYLOAD? That's extremely confusing and makes it quite hard to do any routing for different REQUEST_CHANNELs. Also seems exactly opposite of what the spec says (see the above comment).
robertroeser commentedon Feb 22, 2018
@lexs Please look at the frames below included in this post - they all have the same message. There is no 'setup' payload.
Are you saying that the payload in the REQUEST_CHANNEL frame is identical to the first PAYLOAD?
No - in the method signature requestChannel(Payload payload, Publisher publisher) the payload there is the same as the first item emitted from publisher. It was done that way so it was easier to route (like you pointed out). We removed this, and wrote SwitchTransform to do this instead.
We think this is a better API then CPP version / old Java version because the client and server are now symmetric, and everything can implement as RSockets which are composable. You have one abstraction for everything with the same behavior. For instance you can use the
SpectatorRSocket socket
https://github.com/rsocket/rsocket-java/blob/1.0.x/rsocket-spectator/src/main/java/io/rsocket/spectator/SpectatorRSocket.java
on both the client and the server - you don't have to have a special RequestHandler, and another one for the client.
We did the same thing with DuplexConnection - please take a look at the FragmentationDuplexConnection
https://github.com/rsocket/rsocket-java/blob/1.0.x/rsocket-core/src/main/java/io/rsocket/fragmentation/FragmentationDuplexConnection.java
See the fields below all Request Data fields say: identification of the service being requested along with parameters for the request.
lexs commentedon Feb 26, 2018
In rsocket-cpp the first emitted item was never the same as the request data payload. This is where my confusion stems from.
I find it fairly confusing that the first item of a channel would have a completely different type than the rest, as the first payload (the request data) is the request params. I much rather keep the old API (and not having the first emitted payload be the payload that is part of the
REQUEST_CHANNELframe.I'm not following why this makes it harder to be symmetric, the RSocket class would still exist, the contract is still the same on either side.
requestDatais the data in theREQUEST_CHANNELand is not duplicated in any stream.rstoyanchev commentedon Feb 27, 2018
@robertroeser, I'm trying to understand the argument about client and server symmetry. If there was
Payload setupargument onrequestChannelwouldn't that be used on both sides? The requester for sending the setup, and the responder for processing the setup.To achieve this currently, one has to use
SwitchTransformon the responder side, and attach metadata to the first item in the requesterFlux, which amounts to the same but requires more effort.