Class ConsumerStoppingEvent

  • All Implemented Interfaces:
    java.io.Serializable

    public class ConsumerStoppingEvent
    extends KafkaEvent
    An event published when a consumer is stopped. While it is best practice to use stateless listeners, you can consume this event to clean up any thread-based resources (remove ThreadLocals, destroy thread-scoped beans etc), as long as the context event multicaster is not modified to use an async task executor.
    Since:
    2.2
    Author:
    Gary Russell
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class java.util.EventObject

        source
    • Constructor Summary

      Constructors 
      Constructor Description
      ConsumerStoppingEvent​(java.lang.Object source, java.lang.Object container, org.apache.kafka.clients.consumer.Consumer<?,​?> consumer, java.util.Collection<org.apache.kafka.common.TopicPartition> partitions)
      Construct an instance with the provided source, consumer and partitions.
      ConsumerStoppingEvent​(java.lang.Object source, org.apache.kafka.clients.consumer.Consumer<?,​?> consumer, java.util.Collection<org.apache.kafka.common.TopicPartition> partitions)
      Deprecated.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.kafka.clients.consumer.Consumer<?,​?> getConsumer()  
      java.util.Collection<org.apache.kafka.common.TopicPartition> getPartitions()  
      java.lang.String toString()  
      • Methods inherited from class org.springframework.context.ApplicationEvent

        getTimestamp
      • Methods inherited from class java.util.EventObject

        getSource
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ConsumerStoppingEvent

        @Deprecated
        public ConsumerStoppingEvent​(java.lang.Object source,
                                     org.apache.kafka.clients.consumer.Consumer<?,​?> consumer,
                                     java.util.Collection<org.apache.kafka.common.TopicPartition> partitions)
        Deprecated.
        Construct an instance with the provided source, consumer and partitions.
        Parameters:
        source - the container.
        consumer - the consumer.
        partitions - the partitions.
      • ConsumerStoppingEvent

        public ConsumerStoppingEvent​(java.lang.Object source,
                                     java.lang.Object container,
                                     org.apache.kafka.clients.consumer.Consumer<?,​?> consumer,
                                     java.util.Collection<org.apache.kafka.common.TopicPartition> partitions)
        Construct an instance with the provided source, consumer and partitions.
        Parameters:
        source - the container instance that generated the event.
        container - the container or the parent container if the container is a child.
        consumer - the consumer.
        partitions - the partitions.
        Since:
        2.2.1
    • Method Detail

      • getConsumer

        public org.apache.kafka.clients.consumer.Consumer<?,​?> getConsumer()
      • getPartitions

        public java.util.Collection<org.apache.kafka.common.TopicPartition> getPartitions()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.util.EventObject