Skip to content

Ambiguity with COMPLETE flag in Response frame #126

@NiteshKant

Description

@NiteshKant

Background

Response Frame is designed to eliminate the need of exchanging an additional frame for COMPLETE in cases where it is known while emitting an onNext that there are no more items.

This optimization is pretty useful for Request-Response exchange when it is known beforehand that there would only be one response frame (post fragmented frame coalescing).

In practice, this is less useful for request-stream, request-channel interactions where the presence of a functional composition library makes it more complex to determine whether an item is the last in the stream.

Problem

Since there is no explicit indication that a RESPONSE frame is NEXT_COMPLETE or just COMPLETE, a way to determine whether one should emit an item before completing is to check whether this RESPONSE contains any data or not. Java Implementation uses this approach.

As shown in this PR, this approach is error-prone for request-response interaction as an empty payload converts to just emit onComplete(). I will consider this as an error as request-response should expect either a response or an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions