Publisher to/from various
async/reactive types such as CompletableFuture, RxJava Flowable, etc.
This is designed to complement Spring's Reactor Mono/Flux support while
also being usable without Reactor, e.g. just for org.reactivestreams bridging.
By default, depending on classpath availability, adapters are registered for Reactor
(including CompletableFuture and Flow.Publisher adapters), RxJava 3,
Kotlin Coroutines' Deferred (bridged via Reactor) and SmallRye Mutiny 1.x/2.x.
If Reactor is not present, a simple Flow.Publisher bridge will be registered.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private static class | |
| private static class | |
| private static class | |
| private static class | ReactiveAdapterRegistry.
ReactiveAdapter variant that wraps adapted Publishers as |
| private static class | |
| private static class | |
| public static class | ReactiveAdapterRegistry.
|
| Modifier and Type | Field and Description |
|---|---|
| private final List | |
| private static final boolean | |
| private static final boolean | |
| private static final boolean | |
| private static final boolean | |
| private static final boolean | |
| private static volatile ReactiveAdapterRegistry |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private ReactiveAdapter | buildAdapter(ReactiveTypeDescriptor descriptor, Function<Object, Publisher<?>> toAdapter, Function<Publisher<?>, Object> fromAdapter)
|
| public ReactiveAdapter | Returns: the corresponding adapter, ornull if none availableGet the adapter for the given reactive type. |
| public ReactiveAdapter | Returns: the corresponding adapter, ornull if none availablethe reactive type
(may be reactiveType, Object null if a concrete source object is given)an instance of the reactive type
(i.e. to adapt from; may be source)null if the reactive type is specified)Get the adapter for the given reactive type. |
| public static ReactiveAdapterRegistry | Returns: the sharedReactiveAdapterRegistry instanceReturn a shared default |
| public boolean | |
| public void | registerReactiveType(ReactiveTypeDescriptor descriptor, Function<Object, Publisher<?>> toAdapter, Function<Publisher<?>, Object> fromAdapter)
Register a reactive type along with functions to adapt to and from a
Reactive Streams |
| public void | registerReactiveTypeOverride(ReactiveTypeDescriptor descriptor, Function<Object, Publisher<?>> toAdapter, Function<Publisher<?>, Object> fromAdapter)
Register a reactive type along with functions to adapt to and from a
Reactive Streams |
| adapters | back to summary |
|---|---|
| private final List<ReactiveAdapter> adapters | |
| kotlinCoroutinesPresent | back to summary |
|---|---|
| private static final boolean kotlinCoroutinesPresent | |
| mutinyPresent | back to summary |
|---|---|
| private static final boolean mutinyPresent | |
| reactiveStreamsPresent | back to summary |
|---|---|
| private static final boolean reactiveStreamsPresent | |
| reactorPresent | back to summary |
|---|---|
| private static final boolean reactorPresent | |
| rxjava3Present | back to summary |
|---|---|
| private static final boolean rxjava3Present | |
| sharedInstance | back to summary |
|---|---|
| private static volatile ReactiveAdapterRegistry sharedInstance
| |
| ReactiveAdapterRegistry | back to summary |
|---|---|
| public ReactiveAdapterRegistry() Create a registry and auto-register default adapters.
| |
| buildAdapter | back to summary |
|---|---|
| private ReactiveAdapter buildAdapter(ReactiveTypeDescriptor descriptor, Function<Object, Publisher<?>> toAdapter, Function<Publisher<?>, Object> fromAdapter) | |
| getAdapter | back to summary |
|---|---|
| public ReactiveAdapter getAdapter(Class<?> reactiveType) Get the adapter for the given reactive type.
| |
| getAdapter | back to summary |
|---|---|
| public ReactiveAdapter getAdapter(Class<?> reactiveType, Object source) Get the adapter for the given reactive type. Or if a "source" object is provided, its actual type is used instead.
| |
| getSharedInstance | back to summary |
|---|---|
| public static ReactiveAdapterRegistry getSharedInstance() Return a shared default Note We highly recommend passing a long-lived, pre-configured
| |
| hasAdapters | back to summary |
|---|---|
| public boolean hasAdapters() Return whether the registry has any adapters. | |
| registerReactiveType | back to summary |
|---|---|
| public void registerReactiveType(ReactiveTypeDescriptor descriptor, Function<Object, Publisher<?>> toAdapter, Function<Publisher<?>, Object> fromAdapter) Register a reactive type along with functions to adapt to and from a
Reactive Streams This variant registers the new adapter after existing adapters. It will be matched for the exact reactive type if no earlier adapter was registered for the specific type, and it will be matched for assignability in a second pass if no earlier adapter had an assignable type before.
| |
| registerReactiveTypeOverride | back to summary |
|---|---|
| public void registerReactiveTypeOverride(ReactiveTypeDescriptor descriptor, Function<Object, Publisher<?>> toAdapter, Function<Publisher<?>, Object> fromAdapter) Register a reactive type along with functions to adapt to and from a
Reactive Streams This variant registers the new adapter first, effectively overriding any previously registered adapters for the same reactive type. This allows for overriding existing adapters, in particular default adapters. Note that existing adapters for specific types will still match before an assignability match with the new adapter. In order to override all existing matches, a new reactive type adapter needs to be registered for every specific type, not relying on subtype assignability matches.
| |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void |
| CoroutinesRegistrar | back to summary |
|---|---|
| private CoroutinesRegistrar() | |
| registerAdapters | back to summary |
|---|---|
pack-priv void registerAdapters(ReactiveAdapterRegistry registry)
| |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| EmptyCompletableFuture | back to summary |
|---|---|
| pack-priv EmptyCompletableFuture() | |
| Modifier and Type | Field and Description |
|---|---|
| private static final Flow. | |
| private static final Flow. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void |
| EMPTY_PUBLISHER | back to summary |
|---|---|
| private static final Flow. | |
| EMPTY_SUBSCRIPTION | back to summary |
|---|---|
| private static final Flow. | |
| FlowAdaptersRegistrar | back to summary |
|---|---|
| private FlowAdaptersRegistrar() | |
| registerAdapters | back to summary |
|---|---|
pack-priv void registerAdapters(ReactiveAdapterRegistry registry)
| |
| Modifier and Type | Field and Description |
|---|---|
| private static final Method |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void |
| uniToPublisher | back to summary |
|---|---|
| private static final Method uniToPublisher | |
| MutinyRegistrar | back to summary |
|---|---|
| private MutinyRegistrar() | |
| registerAdapters | back to summary |
|---|---|
pack-priv void registerAdapters(ReactiveAdapterRegistry registry)
| |
Flux or
Mono depending on ReactiveTypeDescriptor#isMultiValue().
This is important in places where only the stream and stream element type
information is available like encoders and decoders.
| Access | Constructor and Description |
|---|---|
| pack-priv | ReactorAdapter(ReactiveTypeDescriptor descriptor, Function<Object, Publisher<?>> toPublisherFunction, Function<Publisher<?>, Object> fromPublisherFunction)
|
| Modifier and Type | Method and Description |
|---|---|
| public <T> Publisher | toPublisher(Object
the source object to adapt from; if the given object is
source)null, ReactiveTypeDescriptor#getEmptyValue() is used.Overrides org. Adapt the given instance to a Reactive Streams |
| ReactorAdapter | back to summary |
|---|---|
| pack-priv ReactorAdapter(ReactiveTypeDescriptor descriptor, Function<Object, Publisher<?>> toPublisherFunction, Function<Publisher<?>, Object> fromPublisherFunction) | |
| toPublisher | back to summary |
|---|---|
| public <T> Publisher Overrides org. Doc from org. Adapt the given instance to a Reactive Streams
| |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void |
| EMPTY_FLOW | back to summary |
|---|---|
| private static final Flow. | |
| ReactorRegistrar | back to summary |
|---|---|
| private ReactorRegistrar() | |
| registerAdapters | back to summary |
|---|---|
| pack-priv void registerAdapters(ReactiveAdapterRegistry registry) | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void |
| RxJava3Registrar | back to summary |
|---|---|
| private RxJava3Registrar() | |
| registerAdapters | back to summary |
|---|---|
| pack-priv void registerAdapters(ReactiveAdapterRegistry registry) | |
BlockHoundIntegration for spring-core classes.
Explicitly allows locking within ConcurrentReferenceHashMap.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | applyTo(BlockHound.
an instance of builderBlockHound. that is being installedImplements reactor. Lets an integration apply the customizations (see |
| SpringCoreBlockHoundIntegration | back to summary |
|---|---|
| public SpringCoreBlockHoundIntegration() | |
| applyTo | back to summary |
|---|---|
| public void applyTo(BlockHound. Implements reactor. Doc from reactor. Lets an integration apply the customizations (see
| |