@Retention(value=RUNTIME)
@Target(value=METHOD)
public @interface PulsarConsumer
| 限定符和类型 | 必需的元素和说明 |
|---|---|
java.lang.String |
topic |
| 限定符和类型 | 可选元素和说明 |
|---|---|
boolean |
autoStart
If value is set to true, the consumer will autostart on application startup automatically.
|
java.lang.Class<?> |
clazz |
java.lang.String |
consumerName
(Optional) Consumer names are auto-generated but in case you wish to use your custom consumer names,
feel free to override it.
|
java.lang.String |
deadLetterTopic
Name of the dead topic where the failing messages will be sent.
|
org.apache.pulsar.client.api.SubscriptionInitialPosition |
initialPosition
When creating a consumer, if the subscription does not exist, a new subscription will be created.
|
int |
maxRedeliverCount
Maximum number of times that a message will be redelivered before being sent to the dead letter queue.
|
java.lang.String |
namespace
Set the namespace, which is set in the configuration file by default.
|
java.lang.String |
paramName
已过时。
|
Serialization |
serialization |
java.lang.String |
subscriptionName
(Optional) Subscription names are auto-generated but in case you wish to use your custom subscription names,
feel free to override it.
|
org.apache.pulsar.client.api.SubscriptionType[] |
subscriptionType
Type of subscription.
|
@Deprecated public abstract java.lang.String paramName
public abstract Serialization serialization
public abstract org.apache.pulsar.client.api.SubscriptionType[] subscriptionType
Shared - This will allow you to have multiple consumers/instances of the application in a cluster with same subscription name and guarantee that the message is read only by one consumer.
Exclusive - message will be delivered to every subscription name only once but won't allow to instantiate multiple instances or consumers of the same subscription name. With a default configuration you don't need to worry about horizontal scaling because message will be delivered to each pod in a cluster since in case of exclusive subscription the name is unique per instance and can be nicely used to update state of each pod in case your service is stateful (For example - you need to update in-memory cached configuration for each instance of authorization microservice).
By default the type is `Exclusive` but you can also override the default in `application.properties`. This can be handy in case you are using `Shared` subscription in your application all the time and you don't want to override this value every time you use `@PulsarConsumer`.
public abstract java.lang.String consumerName
public abstract java.lang.String subscriptionName
public abstract int maxRedeliverCount
public abstract java.lang.String deadLetterTopic
public abstract boolean autoStart
public abstract java.lang.String namespace
public abstract org.apache.pulsar.client.api.SubscriptionInitialPosition initialPosition
Copyright © 2022. All rights reserved.