As a future work of #4727, users might want to dynamically emit the last message depending on whether the upstream publisher completes successfully or exceptionally.
interface StreamMessage<T> {
<T> StreamMessage<T> endWith(Function<@Nullable Throwable, ? extends T> finalizer) {
// Conditionally appends an element using the finalizer
return new SurroundingPublisher(null, this, finalizer);
}
}
As a future work of #4727, users might want to dynamically emit the last message depending on whether the upstream publisher completes successfully or exceptionally.