Class CoroutinesUtils
java.lang.Object
org.springframework.core.CoroutinesUtils
Utilities for working with Kotlin Coroutines.
- Since:
- 5.2
- Author:
- Sebastien Deleuze, Phillip Webb
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Mono<T> deferredToMono(kotlinx.coroutines.Deferred<T> source) Convert aDeferredinstance to aMono.static Publisher<?> invokeSuspendingFunction(Method method, Object target, @Nullable Object... args) static Publisher<?> invokeSuspendingFunction(kotlin.coroutines.CoroutineContext context, Method method, @Nullable Object target, @Nullable Object... args) static <T> kotlinx.coroutines.Deferred<T> monoToDeferred(Mono<T> source) Convert aMonoinstance to aDeferred.
-
Constructor Details
-
CoroutinesUtils
public CoroutinesUtils()
-
-
Method Details
-
deferredToMono
-
monoToDeferred
-
invokeSuspendingFunction
public static Publisher<?> invokeSuspendingFunction(Method method, Object target, @Nullable Object... args) Invoke a suspending function and convert it toMonoorFlux. Uses an unconfined dispatcher, augmented withPropagationContextElementif Reactor automatic context propagation is enabled.- Parameters:
method- the suspending function to invoketarget- the target to invokemethodonargs- the function arguments. If theContinuationargument is specified as the last argument (typicallynull), it is ignored.- Returns:
- the method invocation result as reactive stream
- Throws:
IllegalArgumentException- ifmethodis not a suspending function
-
invokeSuspendingFunction
public static Publisher<?> invokeSuspendingFunction(kotlin.coroutines.CoroutineContext context, Method method, @Nullable Object target, @Nullable Object... args) - Parameters:
context- the coroutine context to usemethod- the suspending function to invoketarget- the target to invokemethodonargs- the function arguments. If theContinuationargument is specified as the last argument (typicallynull), it is ignored.- Returns:
- the method invocation result as reactive stream
- Throws:
IllegalArgumentException- ifmethodis not a suspending function- Since:
- 6.0
-