Class ContainerGroup
- java.lang.Object
-
- org.springframework.kafka.listener.ContainerGroup
-
- All Implemented Interfaces:
org.springframework.context.Lifecycle
public class ContainerGroup extends java.lang.Object implements org.springframework.context.Lifecycle
A group of listener containers.- Since:
- 2.7.3
-
-
Constructor Summary
Constructors Constructor Description ContainerGroup(java.lang.String name)
Construct an instance with the provided name.ContainerGroup(java.lang.String name, java.util.List<MessageListenerContainer> containers)
Construct an instance with the provided name and containers.ContainerGroup(java.lang.String name, MessageListenerContainer... containers)
Construct an instance with the provided name and containers.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addContainers(MessageListenerContainer... theContainers)
Add one or more containers to the group.boolean
allStopped()
Return true if all containers in this group are stopped.boolean
contains(MessageListenerContainer container)
Return true if the provided container is in this group.java.util.Collection<java.lang.String>
getListenerIds()
Return the listener ids of the containers in this group.java.lang.String
getName()
Return the group name.boolean
isRunning()
boolean
removeContainer(MessageListenerContainer container)
Remove a container from the group.void
start()
void
stop()
java.lang.String
toString()
-
-
-
Constructor Detail
-
ContainerGroup
public ContainerGroup(java.lang.String name)
Construct an instance with the provided name.- Parameters:
name
- the group name.
-
ContainerGroup
public ContainerGroup(java.lang.String name, java.util.List<MessageListenerContainer> containers)
Construct an instance with the provided name and containers.- Parameters:
name
- the group name.containers
- the containers.
-
ContainerGroup
public ContainerGroup(java.lang.String name, MessageListenerContainer... containers)
Construct an instance with the provided name and containers.- Parameters:
name
- the group name.containers
- the containers.
-
-
Method Detail
-
getName
public java.lang.String getName()
Return the group name.- Returns:
- the name.
-
getListenerIds
public java.util.Collection<java.lang.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 interfaceorg.springframework.context.Lifecycle
-
stop
public void stop()
- Specified by:
stop
in interfaceorg.springframework.context.Lifecycle
-
isRunning
public boolean isRunning()
- Specified by:
isRunning
in interfaceorg.springframework.context.Lifecycle
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-