Package org.springframework.pulsar.core
Class DefaultPulsarReaderFactory<T>
java.lang.Object
org.springframework.pulsar.core.DefaultPulsarReaderFactory<T>
- Type Parameters:
T
- message type
- All Implemented Interfaces:
PulsarReaderFactory<T>
Default implementation of
PulsarReaderFactory
.- Author:
- Soby Chacko
-
Constructor Summary
ConstructorDescriptionDefaultPulsarReaderFactory
(org.apache.pulsar.client.api.PulsarClient pulsarClient) Construct a reader factory instance with no default configuration.DefaultPulsarReaderFactory
(org.apache.pulsar.client.api.PulsarClient pulsarClient, List<ReaderBuilderCustomizer<T>> defaultConfigCustomizers) Construct a reader factory instance. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.pulsar.client.api.Reader<T>
createReader
(List<String> topics, org.apache.pulsar.client.api.MessageId messageId, org.apache.pulsar.client.api.Schema<T> schema, List<ReaderBuilderCustomizer<T>> customizers) Creating a PulsarReader
based on the provided topics, schema and properties.void
setTopicBuilder
(PulsarTopicBuilder topicBuilder) Non-fully-qualified topic names specified on the created readers will be automatically fully-qualified with a default prefix (domain://tenant/namespace
) according to the specified topic builder.
-
Constructor Details
-
DefaultPulsarReaderFactory
public DefaultPulsarReaderFactory(org.apache.pulsar.client.api.PulsarClient pulsarClient) Construct a reader factory instance with no default configuration.- Parameters:
pulsarClient
- the client used to consume
-
DefaultPulsarReaderFactory
public DefaultPulsarReaderFactory(org.apache.pulsar.client.api.PulsarClient pulsarClient, @Nullable List<ReaderBuilderCustomizer<T>> defaultConfigCustomizers) Construct a reader factory instance.- Parameters:
pulsarClient
- the client used to consumedefaultConfigCustomizers
- the optional list of customizers to apply to the readers or null to use no default configuration
-
-
Method Details
-
setTopicBuilder
Non-fully-qualified topic names specified on the created readers will be automatically fully-qualified with a default prefix (domain://tenant/namespace
) according to the specified topic builder.- Parameters:
topicBuilder
- the topic builder used to fully qualify topic names or null to not fully qualify topic names- Since:
- 1.2.0
-
createReader
public org.apache.pulsar.client.api.Reader<T> createReader(@Nullable List<String> topics, @Nullable org.apache.pulsar.client.api.MessageId messageId, org.apache.pulsar.client.api.Schema<T> schema, @Nullable List<ReaderBuilderCustomizer<T>> customizers) Description copied from interface:PulsarReaderFactory
Creating a PulsarReader
based on the provided topics, schema and properties.- Specified by:
createReader
in interfacePulsarReaderFactory<T>
- Parameters:
topics
- set of topics to read frommessageId
- starting message id to read fromschema
- schema of the message to consumecustomizers
- the optional list of customizers to apply to the reader builder. Note that the customizers are applied last and have the potential for overriding any specified parameters or default properties.- Returns:
- the created reader
-