Skip to content

Conditionally emit the last message of a StreamMessage #4816

@ikhoon

Description

@ikhoon

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);
   }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions