Interface ShareConsumerFactory<K,V>

Type Parameters:
K - the key type.
V - the value type.
All Known Implementing Classes:
DefaultShareConsumerFactory

public interface ShareConsumerFactory<K,V>
The strategy to produce a ShareConsumer instance for Kafka queue support.
Since:
4.0
Author:
Soby Chacko
  • Method Details

    • createShareConsumer

      org.apache.kafka.clients.consumer.ShareConsumer<K,V> createShareConsumer(@Nullable String groupId, @Nullable String clientId)
      Create a share consumer with the provided group id and client id.
      Parameters:
      groupId - the group id (maybe null).
      clientId - the client id.
      Returns:
      the share consumer.
    • createShareConsumer

      default org.apache.kafka.clients.consumer.ShareConsumer<K,V> createShareConsumer(@Nullable String groupId, @Nullable String clientId, Map<String,Object> overrideProperties)
      Create a share consumer with the provided group id, client id, and additional properties that override the factory's configuration. The container uses this to enforce internal configuration (e.g. acknowledgement mode) without mutating the factory's configuration. Implementations that do not override this method will fall back to createShareConsumer(String, String), and the override properties will be ignored.
      Parameters:
      groupId - the group id (maybe null).
      clientId - the client id (maybe null).
      overrideProperties - properties to apply on top of the factory configuration.
      Returns:
      the share consumer.
      Since:
      4.1
    • getConfigurationProperties

      default Map<String,Object> getConfigurationProperties()
      Return an unmodifiable reference to the configuration map for this factory. Useful for cloning to make a similar factory.
      Returns:
      the configs.
    • getKeyDeserializer

      default @Nullable org.apache.kafka.common.serialization.Deserializer<K> getKeyDeserializer()
      Return the configured key deserializer (if provided as an object instead of a class name in the properties).
      Returns:
      the deserializer.
    • getValueDeserializer

      default @Nullable org.apache.kafka.common.serialization.Deserializer<V> getValueDeserializer()
      Return the configured value deserializer (if provided as an object instead of a class name in the properties).
      Returns:
      the deserializer.
    • removeListener

      default boolean removeListener(ShareConsumerFactory.Listener<K,V> listener)
      Remove a listener.
      Parameters:
      listener - the listener.
      Returns:
      true if removed.
    • addListener

      default void addListener(int index, ShareConsumerFactory.Listener<K,V> listener)
      Add a listener at a specific index.
      Parameters:
      index - the index (list position).
      listener - the listener.
    • addListener

      default void addListener(ShareConsumerFactory.Listener<K,V> listener)
      Add a listener.
      Parameters:
      listener - the listener.
    • getListeners

      default List<ShareConsumerFactory.Listener<K,V>> getListeners()
      Get the current list of listeners.
      Returns:
      the listeners.