Class MethodRabbitListenerEndpoint

java.lang.Object
org.springframework.amqp.rabbit.listener.AbstractRabbitListenerEndpoint
org.springframework.amqp.rabbit.listener.MethodRabbitListenerEndpoint
All Implemented Interfaces:
RabbitListenerEndpoint, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware
Direct Known Subclasses:
MultiMethodRabbitListenerEndpoint

public class MethodRabbitListenerEndpoint extends AbstractRabbitListenerEndpoint
A RabbitListenerEndpoint providing the method to invoke to process an incoming message for this endpoint.
Since:
1.4
  • Constructor Details

    • MethodRabbitListenerEndpoint

      public MethodRabbitListenerEndpoint()
  • Method Details

    • setBean

      public void setBean(Object bean)
      Set the object instance that should manage this endpoint.
      Parameters:
      bean - the target bean instance.
    • getBean

      public Object getBean()
    • setMethod

      public void setMethod(Method method)
      Set the method to invoke to process a message managed by this endpoint.
      Parameters:
      method - the target method for the bean.
    • getMethod

      public Method getMethod()
    • setMessageHandlerMethodFactory

      public void setMessageHandlerMethodFactory(org.springframework.messaging.handler.annotation.support.MessageHandlerMethodFactory messageHandlerMethodFactory)
      Set the MessageHandlerMethodFactory to use to build the InvocableHandlerMethod responsible to manage the invocation of this endpoint.
      Parameters:
      messageHandlerMethodFactory - the MessageHandlerMethodFactory instance.
    • setReturnExceptions

      public void setReturnExceptions(boolean returnExceptions)
      Set whether exceptions thrown by the listener should be returned to the sender using the normal replyTo/@SendTo semantics.
      Parameters:
      returnExceptions - true to return exceptions.
      Since:
      2.0
    • setErrorHandler

      public void setErrorHandler(RabbitListenerErrorHandler errorHandler)
      Set the RabbitListenerErrorHandler to invoke if the listener method throws an exception.
      Parameters:
      errorHandler - the error handler.
      Since:
      2.0
    • getMessageHandlerMethodFactory

      protected org.springframework.messaging.handler.annotation.support.MessageHandlerMethodFactory getMessageHandlerMethodFactory()
      Returns:
      the messageHandlerMethodFactory
    • setAdapterProvider

      public void setAdapterProvider(MethodRabbitListenerEndpoint.AdapterProvider adapterProvider)
      Set a provider to create adapter instances.
      Parameters:
      adapterProvider - the provider.
    • createMessageListener

      protected MessagingMessageListenerAdapter createMessageListener(MessageListenerContainer container)
      Description copied from class: AbstractRabbitListenerEndpoint
      Create a MessageListener that is able to serve this endpoint for the specified container.
      Specified by:
      createMessageListener in class AbstractRabbitListenerEndpoint
      Parameters:
      container - the MessageListenerContainer to create a MessageListener.
      Returns:
      a a MessageListener instance.
    • configureListenerAdapter

      protected HandlerAdapter configureListenerAdapter(MessagingMessageListenerAdapter messageListener)
      Create a HandlerAdapter for this listener adapter.
      Parameters:
      messageListener - the listener adapter.
      Returns:
      the handler adapter.
    • createMessageListenerInstance

      protected MessagingMessageListenerAdapter createMessageListenerInstance(@Nullable Boolean batch)
      Create an empty MessagingMessageListenerAdapter instance.
      Parameters:
      batch - whether this endpoint is for a batch listener.
      Returns:
      the MessagingMessageListenerAdapter instance.
    • getEndpointDescription

      protected StringBuilder getEndpointDescription()
      Overrides:
      getEndpointDescription in class AbstractRabbitListenerEndpoint
      Returns:
      a description for this endpoint.

      Available to subclasses, for inclusion in their toString() result.