Class DelegatingInvocableHandler
java.lang.Object
org.springframework.pulsar.listener.adapter.DelegatingInvocableHandler
Delegates to an
InvocableHandlerMethod based on the message payload type.
Matches a single, non-annotated parameter or one that is annotated with
Payload. Matches must be
unambiguous.- Author:
- Soby Chacko
-
Constructor Summary
ConstructorsConstructorDescriptionDelegatingInvocableHandler(List<InvocableHandlerMethod> handlers, InvocableHandlerMethod defaultHandler, Object bean, BeanExpressionResolver beanExpressionResolver, BeanExpressionContext beanExpressionContext, BeanFactory beanFactory, Validator validator) -
Method Summary
Modifier and TypeMethodDescriptionprotected InvocableHandlerMethodfindHandlerForPayload(Class<? extends Object> payloadClass) getBean()Return the bean for this handler.protected InvocableHandlerMethodgetHandlerForPayload(Class<? extends Object> payloadClass) Determine theInvocableHandlerMethodfor the provided type.getMethodNameFor(Object payload) Return a string representation of the method that will be invoked for this payload.booleanInvoke the method with the given message.protected booleanmatchHandlerMethod(Class<? extends Object> payloadClass, InvocableHandlerMethod handler)
-
Constructor Details
-
DelegatingInvocableHandler
public DelegatingInvocableHandler(List<InvocableHandlerMethod> handlers, @Nullable InvocableHandlerMethod defaultHandler, Object bean, @Nullable BeanExpressionResolver beanExpressionResolver, @Nullable BeanExpressionContext beanExpressionContext, @Nullable BeanFactory beanFactory, @Nullable Validator validator)
-
-
Method Details
-
getBean
Return the bean for this handler.- Returns:
- the bean.
-
invoke
Invoke the method with the given message.- Parameters:
message- the message.providedArgs- additional arguments.- Returns:
- the result of the invocation.
- Throws:
Exception- raised if no suitable argument resolver can be found, or the method raised an exception.
-
getHandlerForPayload
Determine theInvocableHandlerMethodfor the provided type.- Parameters:
payloadClass- the payload class.- Returns:
- the handler.
-
findHandlerForPayload
@Nullable protected InvocableHandlerMethod findHandlerForPayload(Class<? extends Object> payloadClass) -
matchHandlerMethod
protected boolean matchHandlerMethod(Class<? extends Object> payloadClass, InvocableHandlerMethod handler) -
getMethodNameFor
Return a string representation of the method that will be invoked for this payload.- Parameters:
payload- the payload.- Returns:
- the method name.
-
hasDefaultHandler
public boolean hasDefaultHandler()
-