Annotation Interface ReactivePulsarListener


@Target({TYPE,METHOD,ANNOTATION_TYPE}) @Retention(RUNTIME) @MessageMapping @Documented public @interface ReactivePulsarListener
Annotation that marks a method to be the target of a Pulsar message listener on the specified topics. The containerFactory() identifies the ReactivePulsarListenerContainerFactory to use to build the Pulsar listener container. If not set, a default container factory is assumed to be available with a bean name of pulsarListenerContainerFactory unless an explicit default has been provided through configuration.

Processing of @ReactivePulsarListener annotations is performed by registering a ReactivePulsarListenerAnnotationBeanPostProcessor. This can be done manually or, more conveniently, through EnableReactivePulsar annotation.

Author:
Christophe Bornet
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Whether to automatically start the container for this listener.
    A pseudo bean name used in SpEL expressions within this annotation to reference the current bean within which this listener is defined.
    Override the container factory's concurrency setting for this listener.
    The bean name or a SpEL expression that resolves to a ReactivePulsarListenerMessageConsumerBuilderCustomizer to use to configure the underlying consumer.
    The bean name of the PulsarListenerContainerFactory to use to create the message listener container responsible to serve this endpoint.
    The bean name or a SpEL expression that resolves to a DeadLetterPolicy to use on the consumer to configure a dead letter policy for message redelivery.
    The unique identifier of the container for this listener.
    org.apache.pulsar.common.schema.SchemaType
    Pulsar schema type for this listener.
    boolean
    Activate stream consumption.
    Pulsar subscription name associated with this listener.
    org.apache.pulsar.client.api.SubscriptionType[]
    Pulsar subscription type for this listener - expected to be a single element array with subscription type or empty array to indicate null type.
    Topic patten to listen to.
    Topics to listen to.
    Set to true or false, to override the default setting in the container factory.
  • Element Details

    • id

      String id
      The unique identifier of the container for this listener.

      If none is specified an auto-generated id is used.

      SpEL #{...} and property placeholders ${...} are supported.

      Returns:
      the id for the container managing for this endpoint.
      See Also:
      Default:
      ""
    • subscriptionName

      String subscriptionName
      Pulsar subscription name associated with this listener.

      SpEL #{...} and property placeholders ${...} are supported.

      Returns:
      the subscription name for this listener
      Default:
      ""
    • subscriptionType

      org.apache.pulsar.client.api.SubscriptionType[] subscriptionType
      Pulsar subscription type for this listener - expected to be a single element array with subscription type or empty array to indicate null type.
      Returns:
      single element array with the subscription type or empty array to indicate no type chosen by user
      Default:
      {Exclusive}
    • schemaType

      org.apache.pulsar.common.schema.SchemaType schemaType
      Pulsar schema type for this listener.
      Returns:
      the schemaType for this listener
      Default:
      NONE
    • containerFactory

      String containerFactory
      The bean name of the PulsarListenerContainerFactory to use to create the message listener container responsible to serve this endpoint.

      If not specified, the default container factory is used, if any. If a SpEL expression is provided (#{...}), the expression can either evaluate to a container factory instance or a bean name.

      Returns:
      the container factory bean name.
      Default:
      ""
    • topics

      String[] topics
      Topics to listen to.

      SpEL #{...} and property placeholders ${...} are supported.

      Returns:
      an array of topics to listen to
      Default:
      {}
    • topicPattern

      String topicPattern
      Topic patten to listen to.

      SpEL #{...} and property placeholders ${...} are supported.

      Returns:
      topic pattern to listen to
      Default:
      ""
    • autoStartup

      String autoStartup
      Whether to automatically start the container for this listener.

      The value can be a literal string representation of boolean (e.g. 'true') or a property placeholder ${...} that resolves to a literal. SpEL #{...} expressions that evaluate to a Boolean or a literal are supported.

      Returns:
      whether to automatically start the container for this listener
      Default:
      ""
    • stream

      boolean stream
      Activate stream consumption.
      Returns:
      if true, the listener method shall take a Flux as input argument.
      Default:
      false
    • beanRef

      String beanRef
      A pseudo bean name used in SpEL expressions within this annotation to reference the current bean within which this listener is defined. This allows access to properties and methods within the enclosing bean. Default '__listener'.

      Returns:
      the pseudo bean name.
      Default:
      "__listener"
    • concurrency

      String concurrency
      Override the container factory's concurrency setting for this listener.

      The value can be a literal string representation of Number (e.g. '3') or a property placeholder ${...} that resolves to a literal. SpEL #{...} expressions that evaluate to a Number or a literal are supported.

      Returns:
      the concurrency for this listener
      Default:
      ""
    • useKeyOrderedProcessing

      String useKeyOrderedProcessing
      Set to true or false, to override the default setting in the container factory. May be a property placeholder or SpEL expression that evaluates to a Boolean or a String, in which case the Boolean.parseBoolean(String) is used to obtain the value.

      SpEL #{...} and property place holders ${...} are supported.

      Returns:
      true to keep ordering by message key when concurrency > 1, false to not keep ordering.
      Default:
      ""
    • deadLetterPolicy

      String deadLetterPolicy
      The bean name or a SpEL expression that resolves to a DeadLetterPolicy to use on the consumer to configure a dead letter policy for message redelivery.
      Returns:
      the bean name or empty string to not set any dead letter policy.
      Default:
      ""
    • consumerCustomizer

      String consumerCustomizer
      The bean name or a SpEL expression that resolves to a ReactivePulsarListenerMessageConsumerBuilderCustomizer to use to configure the underlying consumer.
      Returns:
      the bean name or SpEL expression to the customizer or an empty string to not customize the consumer
      Default:
      ""