Class AbstractKafkaChannel

All Implemented Interfaces:
Aware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, ApplicationContextAware, ExpressionCapable, IntegrationPattern, NamedComponent, IntegrationManagement, TrackableComponent, MessageChannel, InterceptableChannel
Direct Known Subclasses:
PollableKafkaChannel, SubscribableKafkaChannel

public abstract class AbstractKafkaChannel extends AbstractMessageChannel
Abstract MessageChannel backed by an Apache Kafka topic.
Since:
5.4
Author:
Gary Russell, Artem Bilan
  • Field Details

    • topic

      protected final String topic
  • Constructor Details

    • AbstractKafkaChannel

      public AbstractKafkaChannel(org.springframework.kafka.core.KafkaOperations<?,?> template, String topic)
      Construct an instance with the provided KafkaOperations and topic.
      Parameters:
      template - the template.
      topic - the topic.
  • Method Details

    • setGroupId

      public void setGroupId(String groupId)
      Set the group id for the consumer; if not set, the bean name will be used.
      Parameters:
      groupId - the group id.
    • getGroupId

      protected String getGroupId()
    • doSend

      protected boolean doSend(Message<?> message, long timeout)
      Description copied from class: AbstractMessageChannel
      Subclasses must implement this method. A non-negative timeout indicates how long to wait if the channel is at capacity (if the value is 0, it must return immediately with or without success). A negative timeout value indicates that the method should block until either the message is accepted or the blocking thread is interrupted.
      Specified by:
      doSend in class AbstractMessageChannel
      Parameters:
      message - The message.
      timeout - The timeout.
      Returns:
      true if the send was successful.