Class AbstractReactorConnectionOperations<C>
java.lang.Object
io.micronaut.data.connection.support.AbstractReactorConnectionOperations<C>
- Type Parameters:
C
- The connection type
- All Implemented Interfaces:
ReactiveStreamsConnectionOperations<C>
,ReactorConnectionOperations<C>
- Direct Known Subclasses:
DefaultR2dbcReactorConnectionOperations
@Internal
public abstract class AbstractReactorConnectionOperations<C>
extends Object
implements ReactorConnectionOperations<C>
The reactive MongoDB connection operations implementation.
- Since:
- 4.0.0
- Author:
- Denis Stepanov
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract @NonNull org.reactivestreams.Publisher<Void>
closeConnection
(C connection, @NonNull ConnectionDefinition definition) Close the connection.final Optional<ConnectionStatus<C>>
findConnectionStatus
(@NonNull reactor.util.context.ContextView contextView) Obtains the current connection.protected abstract @NonNull org.reactivestreams.Publisher<C>
openConnection
(@NonNull ConnectionDefinition definition) Open a new connection.<T> @NonNull reactor.core.publisher.Flux<T>
withConnectionFlux
(@NonNull ConnectionDefinition definition, @NonNull Function<ConnectionStatus<C>, reactor.core.publisher.Flux<T>> callback) Execute the given handler with a new transaction.<T> @NonNull reactor.core.publisher.Mono<T>
withConnectionMono
(@NonNull ConnectionDefinition definition, @NonNull Function<ConnectionStatus<C>, reactor.core.publisher.Mono<T>> callback) Execute the given handler with a new connection.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.data.connection.reactive.ReactiveStreamsConnectionOperations
withConnection
Methods inherited from interface io.micronaut.data.connection.reactive.ReactorConnectionOperations
getConnectionStatus, withConnection, withConnectionFlux, withConnectionMono
-
Constructor Details
-
AbstractReactorConnectionOperations
public AbstractReactorConnectionOperations()
-
-
Method Details
-
openConnection
@NonNull protected abstract @NonNull org.reactivestreams.Publisher<C> openConnection(@NonNull @NonNull ConnectionDefinition definition) Open a new connection.- Parameters:
definition
- The connection definition- Returns:
- new connection publisher
-
closeConnection
@NonNull protected abstract @NonNull org.reactivestreams.Publisher<Void> closeConnection(@NonNull C connection, @NonNull @NonNull ConnectionDefinition definition) Close the connection.- Parameters:
connection
- The connectiondefinition
- The connection definition- Returns:
- closed publisher
-
findConnectionStatus
public final Optional<ConnectionStatus<C>> findConnectionStatus(@NonNull @NonNull reactor.util.context.ContextView contextView) Description copied from interface:ReactorConnectionOperations
Obtains the current connection.- Specified by:
findConnectionStatus
in interfaceReactorConnectionOperations<C>
- Parameters:
contextView
- The reactor's context view- Returns:
- The optional connection
-
withConnectionFlux
@NonNull public <T> @NonNull reactor.core.publisher.Flux<T> withConnectionFlux(@NonNull @NonNull ConnectionDefinition definition, @NonNull @NonNull Function<ConnectionStatus<C>, reactor.core.publisher.Flux<T>> callback) Description copied from interface:ReactorConnectionOperations
Execute the given handler with a new transaction.- Specified by:
withConnectionFlux
in interfaceReactorConnectionOperations<C>
- Type Parameters:
T
- The emitted type- Parameters:
definition
- The definitioncallback
- The handler- Returns:
- A publisher that emits the result type
-
withConnectionMono
@NonNull public <T> @NonNull reactor.core.publisher.Mono<T> withConnectionMono(@NonNull @NonNull ConnectionDefinition definition, @NonNull @NonNull Function<ConnectionStatus<C>, reactor.core.publisher.Mono<T>> callback) Description copied from interface:ReactorConnectionOperations
Execute the given handler with a new connection.- Specified by:
withConnectionMono
in interfaceReactorConnectionOperations<C>
- Type Parameters:
T
- The emitted type- Parameters:
definition
- The definitioncallback
- The handler- Returns:
- A publisher that emits the result type
-