Class KafkaShareMessageListenerContainerSpec<K,V>
java.lang.Object
org.springframework.integration.dsl.IntegrationComponentSpec<KafkaShareMessageListenerContainerSpec<K,V>, org.springframework.kafka.listener.ShareKafkaMessageListenerContainer<K,V>>
org.springframework.integration.kafka.dsl.KafkaShareMessageListenerContainerSpec<K,V>
- Type Parameters:
K- the key type.V- the value type.
- All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.FactoryBean<org.springframework.kafka.listener.ShareKafkaMessageListenerContainer<K,V>>, org.springframework.beans.factory.InitializingBean, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle
public class KafkaShareMessageListenerContainerSpec<K,V>
extends org.springframework.integration.dsl.IntegrationComponentSpec<KafkaShareMessageListenerContainerSpec<K,V>, org.springframework.kafka.listener.ShareKafkaMessageListenerContainer<K,V>>
A helper class in the Builder pattern style to delegate options to the
ShareKafkaMessageListenerContainer.
Only options that the share consumer container actually honors are exposed here;
unlike KafkaMessageListenerContainerSpec, options such as ackMode,
pollTimeout, consumerRebalanceListener, and idleEventInterval
are not applicable to share consumers and are deliberately omitted.
- Since:
- 7.2
-
Field Summary
Fields inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
logger, PARSER, targetFields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTEFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Method Summary
Modifier and TypeMethodDescriptionacknowledgementCommitCallback(org.apache.kafka.clients.consumer.AcknowledgementCommitCallback acknowledgementCommitCallback) Set the callback to be invoked when acknowledgement commits complete; useful withsyncShareCommits(false)for visibility into async commit success or failure.Set theclient.idto use for the consumer(s).concurrency(int concurrency) Specify the number of consumer threads to create within the container.consumerStartTimeout(Duration consumerStartTimeout) Set the maximum time to wait for the consumer thread(s) to start.Set the group id for this container.listenerTaskExecutor(org.springframework.core.task.AsyncTaskExecutor consumerTaskExecutor) Set the executor for threads that poll the consumer(s).shareAckMode(org.springframework.kafka.listener.ContainerProperties.ShareAckMode shareAckMode) Set the acknowledgment mode for the container.shareAcknowledgmentTimeout(Duration shareAcknowledgmentTimeout) Set the timeout for detecting unacknowledged records inContainerProperties.ShareAckMode.MANUALmode.shareConsumerRecordRecoverer(org.springframework.kafka.listener.ShareConsumerRecordRecoverer shareConsumerRecordRecoverer) Set aShareConsumerRecordRecovererto use when a listener throws an exception.syncShareCommits(boolean syncShareCommits) Set whether to usecommitSync()orcommitAsync()for share consumer acknowledgment commits.Methods inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
_this, afterPropertiesSet, destroy, doGet, getId, getObject, getObjectType, getPhase, isAutoStartup, isRunning, start, stop, stopMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.beans.factory.FactoryBean
isSingletonMethods inherited from interface org.springframework.context.SmartLifecycle
isPauseable, pause, restart
-
Method Details
-
id
- Overrides:
idin classorg.springframework.integration.dsl.IntegrationComponentSpec<KafkaShareMessageListenerContainerSpec<K,V>, org.springframework.kafka.listener.ShareKafkaMessageListenerContainer<K, V>>
-
concurrency
Specify the number of consumer threads to create within the container. Each thread creates its ownShareConsumerinstance and all of them participate in the same share group.- Parameters:
concurrency- the concurrency.- Returns:
- the spec.
- See Also:
-
clientId
Set theclient.idto use for the consumer(s).- Parameters:
clientId- the client id.- Returns:
- the spec.
- See Also:
-
groupId
Set the group id for this container. Overrides anygroup.idproperty provided by the consumer factory configuration.- Parameters:
groupId- the group id.- Returns:
- the spec.
- See Also:
-
acknowledgementCommitCallback
public KafkaShareMessageListenerContainerSpec<K,V> acknowledgementCommitCallback(org.apache.kafka.clients.consumer.AcknowledgementCommitCallback acknowledgementCommitCallback) Set the callback to be invoked when acknowledgement commits complete; useful withsyncShareCommits(false)for visibility into async commit success or failure.- Parameters:
acknowledgementCommitCallback- the callback.- Returns:
- the spec.
- See Also:
-
listenerTaskExecutor
public KafkaShareMessageListenerContainerSpec<K,V> listenerTaskExecutor(org.springframework.core.task.AsyncTaskExecutor consumerTaskExecutor) Set the executor for threads that poll the consumer(s). Needs at leastconcurrencythreads.- Parameters:
consumerTaskExecutor- the executor.- Returns:
- the spec.
- See Also:
-
consumerStartTimeout
public KafkaShareMessageListenerContainerSpec<K,V> consumerStartTimeout(Duration consumerStartTimeout) Set the maximum time to wait for the consumer thread(s) to start.- Parameters:
consumerStartTimeout- the timeout.- Returns:
- the spec.
- See Also:
-