Class ContainerGroup

java.lang.Object
org.springframework.kafka.listener.ContainerGroup
All Implemented Interfaces:
Lifecycle

public class ContainerGroup extends Object implements Lifecycle
A group of listener containers.
Since:
2.7.3
Author:
Gary Russell
  • Constructor Details

    • ContainerGroup

      public ContainerGroup(String name)
      Construct an instance with the provided name.
      Parameters:
      name - the group name.
    • ContainerGroup

      public ContainerGroup(String name, List<MessageListenerContainer> containers)
      Construct an instance with the provided name and containers.
      Parameters:
      name - the group name.
      containers - the containers.
    • ContainerGroup

      public ContainerGroup(String name, MessageListenerContainer... containers)
      Construct an instance with the provided name and containers.
      Parameters:
      name - the group name.
      containers - the containers.
  • Method Details

    • getName

      public String getName()
      Return the group name.
      Returns:
      the name.
    • getListenerIds

      public Collection<String> getListenerIds()
      Return the listener ids of the containers in this group.
      Returns:
      the listener ids.
    • contains

      public boolean contains(MessageListenerContainer container)
      Return true if the provided container is in this group.
      Parameters:
      container - the container.
      Returns:
      true if it is in this group.
    • allStopped

      public boolean allStopped()
      Return true if all containers in this group are stopped.
      Returns:
      true if all are stopped.
    • addContainers

      public void addContainers(MessageListenerContainer... theContainers)
      Add one or more containers to the group.
      Parameters:
      theContainers - the container(s).
    • removeContainer

      public boolean removeContainer(MessageListenerContainer container)
      Remove a container from the group.
      Parameters:
      container - the container.
      Returns:
      true if the container was removed.
    • start

      public void start()
      Specified by:
      start in interface Lifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface Lifecycle
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface Lifecycle
    • toString

      public String toString()
      Overrides:
      toString in class Object