@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 . |
java.lang.String |
clientId
Sets the client id of the Kafka consumer.
|
java.lang.String |
groupId
The same as
value() . |
java.lang.String |
heartbeatInterval
The heart beat interval for the consumer.
|
OffsetReset |
offsetReset |
OffsetStrategy |
offsetStrategy
The
OffsetStrategy to use for the consumer. |
java.lang.String |
pollTimeout
The timeout to use for calls to
Consumer.poll(long) . |
io.micronaut.context.annotation.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.
|
java.lang.String |
sessionTimeout
The session timeout for a consumer.
|
int |
threads
Kafka consumers are by default single threaded.
|
java.lang.String |
value
Sets the consumer group id of the Kafka consumer.
|
@AliasFor(member="groupId") public abstract java.lang.String value
ApplicationConfiguration.getName()
otherwise
the name of the class is used.@AliasFor(member="value") public abstract java.lang.String groupId
value()
.public abstract java.lang.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 java.lang.String pollTimeout
Consumer.poll(long)
.public abstract java.lang.String sessionTimeout
session.timeout.ms
.ConsumerConfig.SESSION_TIMEOUT_MS_DOC
public abstract java.lang.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.