requireNonEmptyStream

fun <T> requireNonEmptyStream(stream: Flow<T>): Flow<T>

Throws IllegalArgumentException if the stream is empty.

Using with spring

This helper method works only if the payload is set to be non-required explicit. Otherwise, spring itself throws another error before this operator is used.

You can set the content to be non-required via spring like this:

@MessageMapping("stream")
fun receiveFlow(
@Payload(required = false) inBoundMessages: Flow<ByteArray>
): Flow<RSocketResponse>