Class HandlerAdapter

java.lang.Object
org.springframework.amqp.rabbit.listener.adapter.HandlerAdapter

public class HandlerAdapter extends Object
A wrapper for either an InvocableHandlerMethod or DelegatingInvocableHandler. All methods delegate to the underlying handler.
Since:
1.5
Author:
Gary Russell
  • Constructor Details

    • HandlerAdapter

      public HandlerAdapter(InvocableHandlerMethod invokerHandlerMethod)
      Construct an instance with the provided method.
      Parameters:
      invokerHandlerMethod - the method.
    • HandlerAdapter

      public HandlerAdapter(DelegatingInvocableHandler delegatingHandler)
      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

      public String getMethodAsString(Object payload)
      Get the method signature for the payload type via Method.toGenericString().
      Parameters:
      payload - the payload.
      Returns:
      the method signature.
    • getMethodFor

      public Method getMethodFor(Object payload)
      Get the method for the payload type.
      Parameters:
      payload - the payload.
      Returns:
      the method.
      Since:
      2.2.3
    • getReturnTypeFor

      public Type getReturnTypeFor(Object payload)
      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

      public Object 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

      @Nullable public InvocationResult getInvocationResultFor(Object result, Object inboundPayload)
      Build an InvocationResult for the result and inbound payload.
      Parameters:
      result - the result.
      inboundPayload - the payload.
      Returns:
      the invocation result.
      Since:
      2.1.7