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.
Background
Response Frame is designed to eliminate the need of exchanging an additional frame for
COMPLETEin cases where it is known while emitting anonNextthat there are no more items.This optimization is pretty useful for
Request-Responseexchange 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
RESPONSEframe isNEXT_COMPLETEor justCOMPLETE, a way to determine whether one should emit an item before completing is to check whether thisRESPONSEcontains 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.