Interface AsyncConnectionOperations<C>
- Type Parameters:
C
- The connection type
- All Known Implementing Classes:
AsyncUsingReactiveConnectionOperations
public interface AsyncConnectionOperations<C>
An interface for async connection manager.
- Since:
- 4.0.0
- Author:
- Denis Stepanov
-
Method Summary
Modifier and TypeMethodDescriptionObtains the current connection.default @NonNull ConnectionStatus<C>
Obtains the current required connection.<T> @NonNull CompletionStage<T>
withConnection
(@NonNull ConnectionDefinition definition, @NonNull Function<ConnectionStatus<C>, CompletionStage<T>> handler) Execute the given handler with a new connection.default <T> @NonNull CompletionStage<T>
withConnection
(@NonNull Function<ConnectionStatus<C>, CompletionStage<T>> handler) Execute the given handler with a new connection.
-
Method Details
-
getConnectionStatus
Obtains the current required connection.- Returns:
- The connection or exception if the connection doesn't exist
-
findConnectionStatus
Optional<ConnectionStatus<C>> findConnectionStatus()Obtains the current connection.- Returns:
- The optional connection
-
withConnection
@NonNull <T> @NonNull CompletionStage<T> withConnection(@NonNull @NonNull ConnectionDefinition definition, @NonNull @NonNull Function<ConnectionStatus<C>, CompletionStage<T>> handler) Execute the given handler with a new connection.- Type Parameters:
T
- The emitted type- Parameters:
definition
- The definitionhandler
- The handler- Returns:
- A publisher that emits the result type
-
withConnection
@NonNull default <T> @NonNull CompletionStage<T> withConnection(@NonNull @NonNull Function<ConnectionStatus<C>, CompletionStage<T>> handler) Execute the given handler with a new connection.- Type Parameters:
T
- The emitted type- Parameters:
handler
- The handler- Returns:
- A publisher that emits the result type
-