Annotation Interface PulsarConsumer


@Documented @Retention(RUNTIME) @Target(METHOD) @Executable @MessageListener public @interface PulsarConsumer
Marks a method as a Pulsar Consumer.
Since:
1.0
Author:
Haris Secic
  • Element Details

    • value

      @AliasFor(member="topic") @AliasFor(annotation=io.micronaut.messaging.annotation.MessageMapping.class,member="value") String value
      Returns:
      Same as topic()
      Default:
      ""
    • topic

      @AliasFor(member="value") @AliasFor(annotation=io.micronaut.messaging.annotation.MessageMapping.class,member="value") String topic
      Has precedence over topics() and topicsPattern(). Single topic to consume messages from.
      Returns:
      Topic name to listen to
      Default:
      ""
    • topics

      @AliasFor(annotation=io.micronaut.messaging.annotation.MessageMapping.class, member="value") String[] topics
      Has precedence over topicPattern.
      Returns:
      String[] of topic names in form of (persistent|non-persistent)://tenant-name/namespace/topic.
      Default:
      {}
    • topicsPattern

      @AliasFor(annotation=io.micronaut.messaging.annotation.MessageMapping.class, member="value") String topicsPattern
      Ignored if topics attribute is set.
      Returns:
      Topics name in form of tenantName/namespace/topic-name-pattern.
      Default:
      ""
    • schema

      Defaults to MessageSchema.BYTES as default value for Pulsar Schema is byte[].
      Returns:
      Schema to use with pulsar topic consumer
      Default:
      BYTES
    • keySchema

      MessageSchema keySchema
      Ignored if keyEncoding() is KeyValueEncodingType.INLINE or if MessageKey is missing on one of the attributes of the annotated method.
      Returns:
      Schema to use while parsing message key from Pulsar message
      Default:
      BYTES
    • keyEncoding

      org.apache.pulsar.common.schema.KeyValueEncodingType keyEncoding
      Ignored if annotated method does not contain parameter annotated with 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.
      Returns:
      Whether to read key from the message payload or separately.
      Default:
      INLINE
    • consumerName

      String consumerName
      Returns:
      Consumer name for more descriptive monitoring
      Default:
      ""
    • subscription

      String subscription
      Returns:
      Subscription name in case consumer was defined outside the PulsarSubscription annotated class
      Default:
      ""
    • subscriptionType

      org.apache.pulsar.client.api.SubscriptionType subscriptionType
      Returns:
      Subscription type in case consumer was defined outside of PulsarSubscription annotated class
      Default:
      Exclusive
    • subscriptionTopicsMode

      org.apache.pulsar.client.api.RegexSubscriptionMode subscriptionTopicsMode
      Ignored if topics() attribute is set. Default value RegexSubscriptionMode.AllTopics

      Whether to read topics from persistent, or non-persistent storage, or both.

      Returns:
      subscription
      Default:
      AllTopics
    • patternAutoDiscoveryPeriod

      int patternAutoDiscoveryPeriod
      Used in combination with topicsPattern(). Ignored using topics(). Must be greater than 1. Low values should be avoided. Pulsar default value is 1 minute
      Returns:
      Amount of delay between checks, in seconds, for new topic matching given pattern.
      Default:
      -1
    • subscribeAsync

      boolean subscribeAsync
      By default, consumer should subscribe in non-blocking manner using default 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.

      Returns:
      Should the consumer subscribe in async manner or blocking
      Default:
      true
    • ackTimeout

      String ackTimeout
      By default, it will use default value of ConsumerBuilder which is disabled and no redelivery happens unless consumer crashed.

      Must be greater than 1s.

      Returns:
      Allowed time to pass before message is acknowledged.
      See Also:
      • ConsumerBuilder.ackTimeout(long, java.util.concurrent.TimeUnit)
      Default:
      ""
    • receiverQueueSize

      int receiverQueueSize
      Returns:
      Number of items allowed in the queue. Default 1000 as in Pulsar Java Client
      Default:
      1000
    • priorityLevel

      int priorityLevel
      By default, no priority is set. Use any value less than 0 to disable. Use anything above 0 to set lower priority level.
      Returns:
      priority level for a consumer
      See Also:
      • ConsumerBuilder.priorityLevel(int)
      Default:
      -1
    • deadLetterTopic

      String deadLetterTopic
      Default is fallback to Pulsar Client Java library.
      Returns:
      Dead Letter topic name.
      Default:
      ""
    • maxRetriesBeforeDlq

      int maxRetriesBeforeDlq
      Returns:
      Maximum numbers of retires before sending message to dead letter queue topic.
      Default:
      16