Class DelegatingInvocableHandler

java.lang.Object
org.springframework.kafka.listener.adapter.DelegatingInvocableHandler

public class DelegatingInvocableHandler extends Object
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:
Gary Russell, Wang Zhiyang
  • Constructor Details

  • Method Details

    • getBean

      public Object getBean()
      Return the bean for this handler.
      Returns:
      the bean.
    • isAsyncReplies

      public boolean isAsyncReplies()
      Return true if any handler method has an async reply type.
      Returns:
      the asyncReply.
      Since:
      3.2
    • invoke

      public Object invoke(Message<?> message, Object... providedArgs) throws Exception
      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

      protected InvocableHandlerMethod getHandlerForPayload(Class<?> payloadClass)
      Determine the InvocableHandlerMethod for 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<?> payloadClass, InvocableHandlerMethod handler)
    • getMethodNameFor

      public String getMethodNameFor(Object payload)
      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()
    • getInvocationResultFor

      @Nullable public InvocationResult getInvocationResultFor(Object result, Object inboundPayload)
      Return the result of a method invocation by providing a result and payload.
      Parameters:
      result - the result.
      inboundPayload - the payload.
      Returns:
      the result of a method invocation.
      Since:
      3.2