Class HandlerAdapter
java.lang.Object
org.springframework.amqp.rabbit.listener.adapter.HandlerAdapter
A wrapper for either an
InvocableHandlerMethod
or
DelegatingInvocableHandler
. All methods delegate to the
underlying handler.- Since:
- 1.5
- Author:
- Gary Russell
-
Constructor Summary
ConstructorDescriptionHandlerAdapter
(DelegatingInvocableHandler delegatingHandler) Construct an instance with the provided delegating handler.HandlerAdapter
(InvocableHandlerMethod invokerHandlerMethod) Construct an instance with the provided method. -
Method Summary
Modifier and TypeMethodDescriptiongetBean()
Get the bean from the handler method.getInvocationResultFor
(Object result, Object inboundPayload) Build anInvocationResult
for the result and inbound payload.getMethodAsString
(Object payload) Get the method signature for the payload type viaMethod.toGenericString()
.getMethodFor
(Object payload) Get the method for the payload type.getReturnTypeFor
(Object payload) Return the return type for the method that will be chosen for this payload.Invoke the appropriate method for the payload.boolean
Return true if any handler method has an async reply type.
-
Constructor Details
-
HandlerAdapter
Construct an instance with the provided method.- Parameters:
invokerHandlerMethod
- the method.
-
HandlerAdapter
Construct an instance with the provided delegating handler.- Parameters:
delegatingHandler
- the handler.
-
-
Method Details
-
invoke
public InvocationResult invoke(@Nullable Message<?> message, Object... providedArgs) throws Exception Invoke the appropriate method for the payload.- Parameters:
message
- the message.providedArgs
- additional arguments.- Returns:
- the invocation result.
- Throws:
Exception
- if one occurs.
-
getMethodAsString
Get the method signature for the payload type viaMethod.toGenericString()
.- Parameters:
payload
- the payload.- Returns:
- the method signature.
-
getMethodFor
Get the method for the payload type.- Parameters:
payload
- the payload.- Returns:
- the method.
- Since:
- 2.2.3
-
getReturnTypeFor
Return the return type for the method that will be chosen for this payload.- Parameters:
payload
- the payload.- Returns:
- the return type, or null if no handler found.
- Since:
- 2.2.3
-
getBean
Get the bean from the handler method.- Returns:
- the bean.
-
isAsyncReplies
public boolean isAsyncReplies()Return true if any handler method has an async reply type.- Returns:
- the asyncReply.
- Since:
- 2.2.21
-
getInvocationResultFor
Build anInvocationResult
for the result and inbound payload.- Parameters:
result
- the result.inboundPayload
- the payload.- Returns:
- the invocation result.
- Since:
- 2.1.7
-