Package io.micronaut.pulsar.annotation
Annotation Interface PulsarReader
@Documented
@Retention(RUNTIME)
@Target({PARAMETER,FIELD,METHOD})
@Around
@Introduction
public @interface PulsarReader
Create and inject Pulsar reader into field.
- Since:
- 1.0
- Author:
- Haris Secic
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionorg.apache.pulsar.common.schema.KeyValueEncodingTypeIf argument annotated withPulsarReaderis ofKeyValueit's possible to choose where to get the message key from.If argument annotated withPulsarReaderis ofKeyValueit's possible to choose different schema for key transfer.@jakarta.validation.constraints.Min(0L) intIgnored onReader.readNextAsync().booleanbooleanBy default, reader should subscribe in non-blocking manner using defaultCompletableFutureofConsumerBuilder.subscribeAsync().Ignored onReader.readNextAsync()or ifreadTimeout()is 0.Only single topic subscription possible for readers.
-
Element Details
-
value
@AliasFor(member="topic") @AliasFor(annotation=io.micronaut.messaging.annotation.MessageMapping.class,member="value") String value- Returns:
- topic name to listen to
- See Also:
- Default:
- ""
-
topic
@AliasFor(member="value") @AliasFor(annotation=io.micronaut.messaging.annotation.MessageMapping.class,member="value") String topicOnly single topic subscription possible for readers.- Returns:
- topic name to listen to
- Default:
- ""
-
subscriptionName
String subscriptionName- Returns:
- Subscription to connect to.
- Default:
- ""
-
schema
MessageSchema schema- Returns:
- Schema to use with pulsar topic consumer
- Default:
- BYTES
-
keySchema
MessageSchema keySchemaIf argument annotated withPulsarReaderis ofKeyValueit's possible to choose different schema for key transfer.- Returns:
- Schema to use while parsing message key from Pulsar message
- Default:
- BYTES
-
keyEncoding
org.apache.pulsar.common.schema.KeyValueEncodingType keyEncodingIf argument annotated withPulsarReaderis ofKeyValueit's possible to choose where to get the message key from. Otherwise, this attribute is ignored.- Returns:
- Whether to read key from the message payload or separately.
- Default:
- INLINE
-
readerName
String readerName- Returns:
- Reader name.
- Default:
- ""
-
subscribeAsync
boolean subscribeAsyncBy default, reader should subscribe in non-blocking manner using defaultCompletableFutureofConsumerBuilder.subscribeAsync().If blocking is set to false, application thread initializing it will block until consumer is successfully subscribed.
- Returns:
- Should the consumer subscribe in async manner or blocking
- Default:
- true
-
startMessageLatest
boolean startMessageLatest- Returns:
- Whether to position reader to the newest available message in queue or not.
- Default:
- true
-
readTimeout
@Min(0L) @jakarta.validation.constraints.Min(0L) int readTimeoutIgnored onReader.readNextAsync(). Use -1 for no timeout (default).- Returns:
- Maximum allowed read time.
- Default:
- 0
-
timeoutUnit
TimeUnit timeoutUnitIgnored onReader.readNextAsync()or ifreadTimeout()is 0.- Returns:
- Time unit for
readTimeout().
- Default:
- SECONDS
-