@Documented @Retention(value=RUNTIME) @Target(value=METHOD) @Executable @MessageListener public @interface PulsarConsumer
Modifier and Type | Required Element and Description |
---|---|
String |
consumerName |
Modifier and Type | Optional Element and Description |
---|---|
String |
ackTimeout
By default, it will use default value of
ConsumerBuilder which is disabled
and no redelivery happens unless consumer crashed. |
String |
deadLetterTopic
Default is fallback to Pulsar Client Java library.
|
org.apache.pulsar.common.schema.KeyValueEncodingType |
keyEncoding
Ignored if annotated method does not contain parameter annotated with
MessageKey . |
MessageSchema |
keySchema
Ignored if
keyEncoding() is KeyValueEncodingType.INLINE or if MessageKey is missing
on one of the attributes of the annotated method. |
int |
maxRetriesBeforeDlq |
int |
patternAutoDiscoveryPeriod
Used in combination with
topicsPattern() . |
int |
priorityLevel
By default no priority is set.
|
int |
receiverQueueSize |
MessageSchema |
schema
|
boolean |
subscribeAsync
By default, consumer should subscribe in non-blocking manner using default
CompletableFuture
of ConsumerBuilder.subscribeAsync() . |
String |
subscription |
org.apache.pulsar.client.api.RegexSubscriptionMode |
subscriptionTopicsMode
Ignored if
topics() attribute is set. |
org.apache.pulsar.client.api.SubscriptionType |
subscriptionType |
@Pattern(regexp="((non-)?persistent://)?((\\w+(-|\\w+)*\\w/)|(\\$\\{tenant\\}))(\\w+(-|\\w+)*\\w/)\\w+(-|\\w+)*\\w") String |
topic
Has precedence over
topics() and topicsPattern() . |
@Pattern(regexp="((non-)?persistent://)?((\\w+(-|\\w+)*\\w/)|(\\$\\{tenant\\}))(\\w+(-|\\w+)*\\w/)\\w+(-|\\w+)*\\w") String[] |
topics
Has precedence over
topicPattern . |
@Pattern(regexp="((non-)?persistent://)?((\\w+(-|\\w+)*\\w/)|(\\$\\{tenant\\}))(\\w+(-?\\w+)?/).+") String |
topicsPattern
Ignored if
topics attribute is set. |
@Pattern(regexp="((non-)?persistent://)?((\\w+(-|\\w+)*\\w/)|(\\$\\{tenant\\}))(\\w+(-|\\w+)*\\w/)\\w+(-|\\w+)*\\w") String |
value |
public abstract String consumerName
@AliasFor(member="topic") @AliasFor(annotation=io.micronaut.messaging.annotation.MessageMapping.class,member="value") @Pattern(regexp="((non-)?persistent://)?((\\w+(-|\\w+)*\\w/)|(\\$\\{tenant\\}))(\\w+(-|\\w+)*\\w/)\\w+(-|\\w+)*\\w") public abstract @Pattern(regexp="((non-)?persistent://)?((\\w+(-|\\w+)*\\w/)|(\\$\\{tenant\\}))(\\w+(-|\\w+)*\\w/)\\w+(-|\\w+)*\\w") String value
topic()
@Pattern(regexp="((non-)?persistent://)?((\\w+(-|\\w+)*\\w/)|(\\$\\{tenant\\}))(\\w+(-|\\w+)*\\w/)\\w+(-|\\w+)*\\w") @AliasFor(member="value") @AliasFor(annotation=io.micronaut.messaging.annotation.MessageMapping.class,member="value") public abstract @Pattern(regexp="((non-)?persistent://)?((\\w+(-|\\w+)*\\w/)|(\\$\\{tenant\\}))(\\w+(-|\\w+)*\\w/)\\w+(-|\\w+)*\\w") String topic
topics()
and topicsPattern()
.
Single topic to consume messages from.@Pattern(regexp="((non-)?persistent://)?((\\w+(-|\\w+)*\\w/)|(\\$\\{tenant\\}))(\\w+(-|\\w+)*\\w/)\\w+(-|\\w+)*\\w") @AliasFor(annotation=io.micronaut.messaging.annotation.MessageMapping.class, member="value") public abstract @Pattern(regexp="((non-)?persistent://)?((\\w+(-|\\w+)*\\w/)|(\\$\\{tenant\\}))(\\w+(-|\\w+)*\\w/)\\w+(-|\\w+)*\\w") String[] topics
topicPattern
.@Pattern(regexp="((non-)?persistent://)?((\\w+(-|\\w+)*\\w/)|(\\$\\{tenant\\}))(\\w+(-?\\w+)?/).+") @AliasFor(annotation=io.micronaut.messaging.annotation.MessageMapping.class, member="value") public abstract @Pattern(regexp="((non-)?persistent://)?((\\w+(-|\\w+)*\\w/)|(\\$\\{tenant\\}))(\\w+(-?\\w+)?/).+") String topicsPattern
topics
attribute is set.public abstract MessageSchema schema
public abstract MessageSchema keySchema
keyEncoding()
is KeyValueEncodingType.INLINE
or if MessageKey
is missing
on one of the attributes of the annotated method.public abstract org.apache.pulsar.common.schema.KeyValueEncodingType keyEncoding
MessageKey
. Indicates to message
processor is the key inside message payload or stored separately in which case key can have different schema
from message body. Type KeyValueEncodingType.INLINE
can only work for JSON or Avro schemas; otherwise
throws exception while reading.public abstract String subscription
PulsarSubscription
annotated classpublic abstract org.apache.pulsar.client.api.SubscriptionType subscriptionType
PulsarSubscription
annotated classpublic abstract org.apache.pulsar.client.api.RegexSubscriptionMode subscriptionTopicsMode
topics()
attribute is set.
Default value RegexSubscriptionMode.AllTopics
Whether to read topics from persistent, or non-persistent storage, or both.
public abstract int patternAutoDiscoveryPeriod
topicsPattern()
. Ignored using topics()
. Must be greater than
1. Low values should be avoided. Pulsar default value is 1 minutepublic abstract boolean subscribeAsync
CompletableFuture
of ConsumerBuilder.subscribeAsync()
.
If blocking set to false application will block until consumer is successfully subscribed. This is different from the actual process of consuming the messages which still happens in separate thread managed by the underlying Pulsar Client library.
public abstract String ackTimeout
ConsumerBuilder
which is disabled
and no redelivery happens unless consumer crashed.
Must be greater than 1s.
ConsumerBuilder.ackTimeout(long, java.util.concurrent.TimeUnit)
public abstract int receiverQueueSize
public abstract int priorityLevel
ConsumerBuilder.priorityLevel(int)
public abstract String deadLetterTopic