Package org.axonframework.messaging.core
Class MonoUtils
java.lang.Object
org.axonframework.messaging.core.MonoUtils
Utility methods to work with Project Reactor's
monos.- Since:
- 5.0.0
- Author:
- John Hendrikx
-
Method Summary
Modifier and TypeMethodDescriptionstatic <M extends Message>
MessageStream.Single<M> asSingle(reactor.core.publisher.Mono<M> mono) Create a stream that returns a singlewrapping theinvalid reference
entryMessagefrom the givenmono, once the givenmonocompletes.static <M extends Message>
MessageStream.Single<M> Create a stream that returns a singlewrapping theinvalid reference
entryMessagefrom the givenmono, once the givenmonocompletes.
-
Method Details
-
asSingle
public static <M extends Message> MessageStream.Single<M> asSingle(@Nonnull reactor.core.publisher.Mono<M> mono) Create a stream that returns a singlewrapping theinvalid reference
entryMessagefrom the givenmono, once the givenmonocompletes.The stream will contain at most a single entry. It may also contain no entries if the mono completes empty. The stream will complete with an exception when the given
monocompletes exceptionally. -
asSingle
public static <M extends Message> MessageStream.Single<M> asSingle(@Nonnull reactor.core.publisher.Mono<M> mono, @Nonnull Function<M, Context> contextSupplier) Create a stream that returns a singlewrapping theinvalid reference
entryMessagefrom the givenmono, once the givenmonocompletes.The automatically generated
Entrywill have theContextas given by thecontextSupplier.The stream will contain at most a single entry. It may also contain no entries if the mono completes empty. The stream will complete with an exception when the given
monocompletes exceptionally.- Type Parameters:
M- The type ofMessagecontained in theof this stream.invalid reference
entries- Parameters:
mono- TheMonoproviding theMessageto contain in the stream.contextSupplier- AFunctioningesting theMessagefrom the givenmonoreturning theContextto set for thetheinvalid reference
EntryMessageis wrapped in.- Returns:
- A stream containing at most one
from the given
invalid reference
entrymono.
-