Class MethodKafkaListenerEndpoint<K,V>

java.lang.Object
org.springframework.kafka.config.AbstractKafkaListenerEndpoint<K,V>
org.springframework.kafka.config.MethodKafkaListenerEndpoint<K,V>
Type Parameters:
K - the key type.
V - the value type.
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean, KafkaListenerEndpoint
Direct Known Subclasses:
MultiMethodKafkaListenerEndpoint

public class MethodKafkaListenerEndpoint<K,V> extends AbstractKafkaListenerEndpoint<K,V>
A KafkaListenerEndpoint providing the method to invoke to process an incoming message for this endpoint.
  • Constructor Details

    • MethodKafkaListenerEndpoint

      public MethodKafkaListenerEndpoint()
  • 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.
    • setErrorHandler

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

      public void setMessagingConverter(org.springframework.messaging.converter.SmartMessageConverter messagingConverter)
      Set a spring-messaging SmartMessageConverter to convert the record value to the desired type. This will also cause the MessageHeaders.CONTENT_TYPE to be converted to String when mapped inbound.
      Parameters:
      messagingConverter - the converter.
      Since:
      2.7.1
    • getMessageHandlerMethodFactory

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

      protected MessagingMessageListenerAdapter<K,V> createMessageListener(MessageListenerContainer container, @Nullable MessageConverter messageConverter)
      Description copied from class: AbstractKafkaListenerEndpoint
      Create a MessageListener that is able to serve this endpoint for the specified container.
      Specified by:
      createMessageListener in class AbstractKafkaListenerEndpoint<K,V>
      Parameters:
      container - the MessageListenerContainer to create a MessageListener.
      messageConverter - the message converter - may be null.
      Returns:
      a MessageListener instance.
    • configureListenerAdapter

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

      protected MessagingMessageListenerAdapter<K,V> createMessageListenerInstance(@Nullable MessageConverter messageConverter)
      Create an empty MessagingMessageListenerAdapter instance.
      Parameters:
      messageConverter - the converter (may be null).
      Returns:
      the MessagingMessageListenerAdapter instance.
    • getEndpointDescription

      protected StringBuilder getEndpointDescription()
      Description copied from class: AbstractKafkaListenerEndpoint
      Return a description for this endpoint.
      Overrides:
      getEndpointDescription in class AbstractKafkaListenerEndpoint<K,V>
      Returns:
      a description for this endpoint.

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