Skip to content

Adds specific requestChannel(Payload, Publisher<Payload>) #572

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

Merged
merged 4 commits into from
Jan 31, 2019

Conversation

robertroeser
Copy link
Member

Optimize request channel to let you peak at the first item in the stream #569

@robertroeser robertroeser force-pushed the requestChannelImprovements branch from 43d44ee to 48acae8 Compare January 28, 2019 09:18
import reactor.core.publisher.Flux;

/**
* Extends the {@link RSocket} that allows an implementor to peek at the first request payload of a channel.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Extends the {@link RSocket} that allows an implementor to peek at the first request payload of a channel.
* Extends the {@link RSocket} that allows an implementer to peek at the first request payload of a channel.

*/
public interface RequestHandler extends RSocket {
/**
* Implement this method to peak at the first payload of the incoming request stream
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe clarify that peak means that payloads still includes the peaked payload.

Signed-off-by: Robert Roeser <[email protected]>

private final DuplexConnection connection;
private final RSocket requestHandler;
private final RequestHandler optimizedRequestHandler;
private final boolean hasOptimizedRequestHandler;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for an extra boolean property, just checking optimizedRequestHandler != null should be fine

if (requestHandler instanceof RequestHandler) {
this.optimizedRequestHandler = (RequestHandler) requestHandler;
this.hasOptimizedRequestHandler = true;
this.requestHandler = null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep the requestHandler assigned anyway for consistency.

Signed-off-by: Robert Roeser <[email protected]>
@robertroeser robertroeser force-pushed the requestChannelImprovements branch from 4d69ee2 to 92a4d1d Compare January 30, 2019 00:00
@robertroeser robertroeser force-pushed the requestChannelImprovements branch from 6eaef08 to f2a73a8 Compare January 31, 2019 01:32
@robertroeser robertroeser merged commit 21c39bd into 1.0.x Jan 31, 2019
robertroeser added a commit that referenced this pull request Feb 8, 2019
* optimize request channel to let you peak at the first item in the requestChannel

Signed-off-by: Robert Roeser <[email protected]>

* updated javadoc

Signed-off-by: Robert Roeser <[email protected]>

* updates

Signed-off-by: Robert Roeser <[email protected]>

* call requestChannelWith 2 arguments

Signed-off-by: Robert Roeser <[email protected]>
Signed-off-by: Robert Roeser <[email protected]>
robertroeser added a commit that referenced this pull request Feb 12, 2019
* Adds specific requestChannel(Payload, Publisher<Payload>)  (#572)

* optimize request channel to let you peak at the first item in the requestChannel

Signed-off-by: Robert Roeser <[email protected]>

* updated javadoc

Signed-off-by: Robert Roeser <[email protected]>

* updates

Signed-off-by: Robert Roeser <[email protected]>

* call requestChannelWith 2 arguments

Signed-off-by: Robert Roeser <[email protected]>
Signed-off-by: Robert Roeser <[email protected]>

* first pass at refactoring to idomatic ByteBuf flyweights

Signed-off-by: Robert Roeser <[email protected]>

* fixing tests

Signed-off-by: Robert Roeser <[email protected]>

* fixed some more tests

Signed-off-by: Robert Roeser <[email protected]>

* fix frame flyweights

Signed-off-by: Robert Roeser <[email protected]>

* testing

Signed-off-by: Robert Roeser <[email protected]>

* accept ByteBufAllocator in a constructors and renames FrameDecoder to PayloadDecoder

Signed-off-by: Robert Roeser <[email protected]>

* javadoc

Signed-off-by: Robert Roeser <[email protected]>

* first pass at refactoring to idomatic ByteBuf flyweights

Signed-off-by: Robert Roeser <[email protected]>

* fixing tests

Signed-off-by: Robert Roeser <[email protected]>

* fixed some more tests

Signed-off-by: Robert Roeser <[email protected]>

* testing

Signed-off-by: Robert Roeser <[email protected]>

* fix frame flyweights

Signed-off-by: Robert Roeser <[email protected]>

* accept ByteBufAllocator in a constructors and renames FrameDecoder to PayloadDecoder

Signed-off-by: Robert Roeser <[email protected]>

* javadoc

Signed-off-by: Robert Roeser <[email protected]>

* setup frame flyweight: allow null metadata

restore micrometer RSocket test

Signed-off-by: Maksym Ostroverkhov <[email protected]>

* apply fixes from review

release ByteBufs in tests

Signed-off-by: Maksym Ostroverkhov <[email protected]>
@nebhale nebhale deleted the requestChannelImprovements branch February 20, 2019 18:18
@rstoyanchev
Copy link
Contributor

rstoyanchev commented Feb 25, 2019

Not sure if this is expected or not but I tried using the ResponderRSocket interface and ran into UnsupportedOperationException because of an RSocketProxy interceptor that is only aware of the RSocket interface. In my case it was an easy fix but I can imagine a case where the interceptor is not mine to change, plus it means my ResponderRSocket is fragile and could break.

Perhaps there needs to be an ResponderRSocketProxy and that should be expected for a receiving side interceptor?

mostroverkhov pushed a commit to mostroverkhov/rsocket-java that referenced this pull request Feb 27, 2019
* Adds specific requestChannel(Payload, Publisher<Payload>)  (rsocket#572)

* optimize request channel to let you peak at the first item in the requestChannel

Signed-off-by: Robert Roeser <[email protected]>

* updated javadoc

Signed-off-by: Robert Roeser <[email protected]>

* updates

Signed-off-by: Robert Roeser <[email protected]>

* call requestChannelWith 2 arguments

Signed-off-by: Robert Roeser <[email protected]>
Signed-off-by: Robert Roeser <[email protected]>

* first pass at refactoring to idomatic ByteBuf flyweights

Signed-off-by: Robert Roeser <[email protected]>

* fixing tests

Signed-off-by: Robert Roeser <[email protected]>

* fixed some more tests

Signed-off-by: Robert Roeser <[email protected]>

* fix frame flyweights

Signed-off-by: Robert Roeser <[email protected]>

* testing

Signed-off-by: Robert Roeser <[email protected]>

* accept ByteBufAllocator in a constructors and renames FrameDecoder to PayloadDecoder

Signed-off-by: Robert Roeser <[email protected]>

* javadoc

Signed-off-by: Robert Roeser <[email protected]>

* first pass at refactoring to idomatic ByteBuf flyweights

Signed-off-by: Robert Roeser <[email protected]>

* fixing tests

Signed-off-by: Robert Roeser <[email protected]>

* fixed some more tests

Signed-off-by: Robert Roeser <[email protected]>

* testing

Signed-off-by: Robert Roeser <[email protected]>

* fix frame flyweights

Signed-off-by: Robert Roeser <[email protected]>

* accept ByteBufAllocator in a constructors and renames FrameDecoder to PayloadDecoder

Signed-off-by: Robert Roeser <[email protected]>

* javadoc

Signed-off-by: Robert Roeser <[email protected]>

* setup frame flyweight: allow null metadata

restore micrometer RSocket test

Signed-off-by: Maksym Ostroverkhov <[email protected]>

* apply fixes from review

release ByteBufs in tests

Signed-off-by: Maksym Ostroverkhov <[email protected]>
Signed-off-by: Maksym Ostroverkhov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants