@ -109,12 +109,8 @@ public class InvocableHandlerMethod extends HandlerMethod {
@@ -109,12 +109,8 @@ public class InvocableHandlerMethod extends HandlerMethod {
}
/ * *
* Configure a reactive registry . This is needed for cases where the response
* is fully handled within the controller in combination with an async void
* return value .
* < p > By default this is an instance of { @link ReactiveAdapterRegistry } with
* default settings .
* @param registry the registry to use
* Configure a reactive adapter registry . This is needed for async return values .
* < p > By default this is a { @link ReactiveAdapterRegistry } with default settings .
* /
public void setReactiveAdapterRegistry ( ReactiveAdapterRegistry registry ) {
this . reactiveAdapterRegistry = registry ;
@ -125,11 +121,10 @@ public class InvocableHandlerMethod extends HandlerMethod {
@@ -125,11 +121,10 @@ public class InvocableHandlerMethod extends HandlerMethod {
* Invoke the method for the given exchange .
* @param message the current message
* @param providedArgs optional list of argument values to match by type
* @return a Mono with the result from the invocation .
* @return a Mono with the result from the invocation
* /
@SuppressWarnings ( "KotlinInternalInJava" )
public Mono < Object > invoke ( Message < ? > message , Object . . . providedArgs ) {
return getMethodArgumentValues ( message , providedArgs ) . flatMap ( args - > {
Object value ;
try {
@ -157,16 +152,17 @@ public class InvocableHandlerMethod extends HandlerMethod {
@@ -157,16 +152,17 @@ public class InvocableHandlerMethod extends HandlerMethod {
MethodParameter returnType = getReturnType ( ) ;
ReactiveAdapter adapter = this . reactiveAdapterRegistry . getAdapter ( returnType . getParameterType ( ) ) ;
return isAsyncVoidReturnType ( returnType , adapter ) ?
Mono . from ( adapter . toPublisher ( value ) ) : Mono . justOrEmpty ( value ) ;
return ( isAsyncVoidReturnType ( returnType , adapter ) ?
Mono . from ( adapter . toPublisher ( value ) ) : Mono . justOrEmpty ( value ) ) ;
} ) ;
}
private Mono < Object [ ] > getMethodArgumentValues ( Message < ? > message , Object . . . providedArgs ) {
MethodParameter [ ] parameters = getMethodParameters ( ) ;
if ( ObjectUtils . isEmpty ( getMethodParameters ( ) ) ) {
return EMPTY_ARGS ;
}
MethodParameter [ ] parameters = getMethodParameters ( ) ;
List < Mono < Object > > argMonos = new ArrayList < > ( parameters . length ) ;
for ( MethodParameter parameter : parameters ) {
parameter . initParameterNameDiscovery ( this . parameterNameDiscoverer ) ;
@ -196,7 +192,7 @@ public class InvocableHandlerMethod extends HandlerMethod {
@@ -196,7 +192,7 @@ public class InvocableHandlerMethod extends HandlerMethod {
private void logArgumentErrorIfNecessary ( MethodParameter parameter , Throwable ex ) {
// Leave stack trace for later, if error is not handled...
String exMsg = ex . getMessage ( ) ;
if ( ! exMsg . contains ( parameter . getExecutable ( ) . toGenericString ( ) ) ) {
if ( exMsg ! = null & & ! exMsg . contains ( parameter . getExecutable ( ) . toGenericString ( ) ) ) {
if ( logger . isDebugEnabled ( ) ) {
logger . debug ( formatArgumentError ( parameter , exMsg ) ) ;
}