Skip to content

Empty Payload Response treated as Complete frame#206

Merged
NiteshKant merged 2 commits into
rsocket:0.5.xfrom
NiteshKant:0.5.x-next-complete
Dec 14, 2016
Merged

Empty Payload Response treated as Complete frame#206
NiteshKant merged 2 commits into
rsocket:0.5.xfrom
NiteshKant:0.5.x-next-complete

Conversation

@NiteshKant

Copy link
Copy Markdown
Contributor

Problem

FrameHeaderFlyweight resolves the frame type as NEXT_COMPLETE only if the payload is not empty. Otherwise, the frame is treated as COMPLETE.
This is a problem for request-response as this means the response publisher will complete without emitting a response, if the response does not have any data. Such a condition is a failure as request-response should have exaclty one response.

Modification

Eliminated the check for data length and always emit NEXT_COMPLETE if the complete flag is set.
According to the protocol:

A Response is generally referred to as a NEXT.

So, this behavior would not be a violation of the protocol but will produce empty onNext before onComplete

Result

Better behavior with empty responses.

#### Problem

`FrameHeaderFlyweight` resolves the frame type as `NEXT_COMPLETE` only if the payload is not empty. Otherwise, the frame is treated as `COMPLETE`.
This is a problem for request-response as this means the response publisher will complete without emitting a response, if the response does not have any data. Such a condition is a failure as request-response should have exaclty one response.

 #### Modification

 Eliminated the check for data length and always emit `NEXT_COMPLETE` if the complete flag is set.
 According to the [protocol](https://github.com/ReactiveSocket/reactivesocket/blob/master/Protocol.md#response-frame):

 ```
 A Response is generally referred to as a NEXT.
 ```

 So, this behavior would not be a violation of the protocol but will produce empty `onNext` before `onComplete`

 #### Result

 Better behavior with empty responses.

@stevegury stevegury left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

@NiteshKant
NiteshKant merged commit b8fd58a into rsocket:0.5.x Dec 14, 2016
@NiteshKant
NiteshKant deleted the 0.5.x-next-complete branch December 14, 2016 17:47
NiteshKant added a commit to NiteshKant/reactivesocket-java that referenced this pull request Dec 14, 2016
#### Problem

`FrameHeaderFlyweight` resolves the frame type as `NEXT_COMPLETE` only if the payload is not empty. Otherwise, the frame is treated as `COMPLETE`.
This is a problem for request-response as this means the response publisher will complete without emitting a response, if the response does not have any data. Such a condition is a failure as request-response should have exaclty one response.

 #### Modification

 Eliminated the check for data length and always emit `NEXT_COMPLETE` if the complete flag is set.
 According to the [protocol](https://github.com/ReactiveSocket/reactivesocket/blob/master/Protocol.md#response-frame):

 ```
 A Response is generally referred to as a NEXT.
 ```

 So, this behavior would not be a violation of the protocol but will produce empty `onNext` before `onComplete`

 #### Result

 Better behavior with empty responses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants