@Documented @Retention(value=RUNTIME) @Target(value={TYPE,METHOD,ANNOTATION_TYPE}) @MessageListener public @interface KafkaListener
Annotation applied at the class level to indicate that a bean is a Kafka Consumer
.
Modifier and Type | Optional Element and Description |
---|---|
boolean |
batch
By default each listener will consume a single
ConsumerRecord . |
String |
clientId
Sets the client id of the Kafka consumer.
|
String |
groupId
The same as
value() . |
String |
heartbeatInterval
The heart beat interval for the consumer.
|
OffsetReset |
offsetReset |
OffsetStrategy |
offsetStrategy
The
OffsetStrategy to use for the consumer. |
String |
pollTimeout
The timeout to use for calls to
Consumer.poll(long) . |
Property[] |
properties
Additional properties to configure with for Consumer.
|
boolean |
redelivery
For listeners that return reactive types, message offsets are committed without blocking the consumer.
|
String |
sessionTimeout
The session timeout for a consumer.
|
int |
threads
Kafka consumers are by default single threaded.
|
String |
value
Sets the consumer group id of the Kafka consumer.
|
@AliasFor(member="groupId") public abstract String value
ApplicationConfiguration.getName()
otherwise
the name of the class is used.public abstract String clientId
ApplicationConfiguration.getName()
.public abstract OffsetStrategy offsetStrategy
OffsetStrategy
to use for the consumer.OffsetStrategy
public abstract OffsetReset offsetReset
public abstract int threads
NOTE: When using this setting if your bean is Singleton
then local state will be s
shared between invocations from different consumer threads
public abstract String pollTimeout
Consumer.poll(long)
.public abstract String sessionTimeout
session.timeout.ms
.ConsumerConfig.SESSION_TIMEOUT_MS_DOC
public abstract String heartbeatInterval
heartbeat.interval.ms
.ConsumerConfig.HEARTBEAT_INTERVAL_MS_DOC
public abstract boolean redelivery
public abstract boolean batch
ConsumerRecord
.
By setting this value to true
and specifying a container type in the method signatures you can indicate that the method should instead receive all the records at once in a batch.public abstract Property[] properties