Package org.springframework.pulsar.core
Interface PulsarConsumerFactory<T>
- Type Parameters:
T
- payload type for the consumer.
- All Known Implementing Classes:
DefaultPulsarConsumerFactory
public interface PulsarConsumerFactory<T>
Pulsar consumer factory interface.
- Author:
- Soby Chacko, Christophe Bornet, Chris Bono, Jonas Geiregat
-
Method Summary
Modifier and TypeMethodDescriptionorg.apache.pulsar.client.api.Consumer<T>
createConsumer
(org.apache.pulsar.client.api.Schema<T> schema, Collection<String> topics, String subscriptionName, Map<String, String> metadataProperties, List<ConsumerBuilderCustomizer<T>> customizers) Create a consumer.org.apache.pulsar.client.api.Consumer<T>
createConsumer
(org.apache.pulsar.client.api.Schema<T> schema, Collection<String> topics, String subscriptionName, ConsumerBuilderCustomizer<T> customizer) Create a consumer.
-
Method Details
-
createConsumer
org.apache.pulsar.client.api.Consumer<T> createConsumer(org.apache.pulsar.client.api.Schema<T> schema, @Nullable Collection<String> topics, @Nullable String subscriptionName, ConsumerBuilderCustomizer<T> customizer) Create a consumer.- Parameters:
schema
- the schema of the messages to be senttopics
- the topics the consumer will subscribe to, replacing the default topics, ornull
to use the default topics. Beware that usingConsumerBuilder.topic(java.lang.String...)
orConsumerBuilder.topics(java.util.List<java.lang.String>)
will add to the default topics, not override them. Also beware that specifyingnull
when no default topic is configured will result in an exception.subscriptionName
- the name to use for the subscription to the consumed topic(s) ornull
to use the default configured subscription name. Beware that specifyingnull
when no default subscription name is configured will result in an exceptioncustomizer
- an optional customizer to apply to the consumer builder. Note that the customizer is applied last and has the potential for overriding any specified parameters or default properties.- Returns:
- the consumer
- Throws:
PulsarException
- if anyPulsarClientException
occurs communicating with Pulsar
-
createConsumer
org.apache.pulsar.client.api.Consumer<T> createConsumer(org.apache.pulsar.client.api.Schema<T> schema, @Nullable Collection<String> topics, @Nullable String subscriptionName, @Nullable Map<String, String> metadataProperties, @Nullable List<ConsumerBuilderCustomizer<T>> customizers) Create a consumer.- Parameters:
schema
- the schema of the messages to be senttopics
- the topics the consumer will subscribe to, replacing the default topics, ornull
to use the default topics. Beware that usingConsumerBuilder.topic(java.lang.String...)
orConsumerBuilder.topics(java.util.List<java.lang.String>)
will add to the default topics, not override them. Also beware that specifyingnull
when no default topic is configured will result in an exception.subscriptionName
- the name to use for the subscription to the consumed topic(s) ornull
to use the default configured subscription name. Beware that specifyingnull
when no default subscription name is configured will result in an exceptionmetadataProperties
- the metadata properties to attach to the consumer, replacing the default metadata properties, ornull
to use the default metadata properties. Beware that usingConsumerBuilder.property(java.lang.String, java.lang.String)
orConsumerBuilder.properties(java.util.Map<java.lang.String, java.lang.String>)
will add to the default metadata properties, not replace them.customizers
- the optional list of customizers to apply to the consumer builder. Note that the customizers are applied last and have the potential for overriding any specified parameters or default properties.- Returns:
- the consumer
- Throws:
PulsarException
- if anyPulsarClientException
occurs communicating with Pulsar
-