Package org.springframework.pulsar.core
Interface PulsarProducerFactory<T>
- Type Parameters:
T
- producer payload type
- All Known Implementing Classes:
CachingPulsarProducerFactory
,DefaultPulsarProducerFactory
public interface PulsarProducerFactory<T>
The strategy to create a
Producer
instance(s).- Author:
- Soby Chacko, Chris Bono, Alexander Preuß, Christophe Bornet
-
Method Summary
Modifier and TypeMethodDescriptionorg.apache.pulsar.client.api.Producer<T>
createProducer
(org.apache.pulsar.client.api.Schema<T> schema) Create a producer.org.apache.pulsar.client.api.Producer<T>
createProducer
(org.apache.pulsar.client.api.Schema<T> schema, String topic) Create a producer.org.apache.pulsar.client.api.Producer<T>
createProducer
(org.apache.pulsar.client.api.Schema<T> schema, String topic, Collection<String> encryptionKeys, List<ProducerBuilderCustomizer<T>> customizers) Create a producer.Return a map of configuration options to use when creating producers.
-
Method Details
-
createProducer
org.apache.pulsar.client.api.Producer<T> createProducer(org.apache.pulsar.client.api.Schema<T> schema) throws org.apache.pulsar.client.api.PulsarClientException Create a producer.- Parameters:
schema
- the schema of the messages to be sent- Returns:
- the producer
- Throws:
org.apache.pulsar.client.api.PulsarClientException
- if any error occurs
-
createProducer
org.apache.pulsar.client.api.Producer<T> createProducer(org.apache.pulsar.client.api.Schema<T> schema, @Nullable String topic) throws org.apache.pulsar.client.api.PulsarClientException Create a producer.- Parameters:
schema
- the schema of the messages to be senttopic
- the topic the producer will send messages to ornull
to use the default topic- Returns:
- the producer
- Throws:
org.apache.pulsar.client.api.PulsarClientException
- if any error occurs
-
createProducer
org.apache.pulsar.client.api.Producer<T> createProducer(org.apache.pulsar.client.api.Schema<T> schema, @Nullable String topic, @Nullable Collection<String> encryptionKeys, @Nullable List<ProducerBuilderCustomizer<T>> customizers) throws org.apache.pulsar.client.api.PulsarClientException Create a producer.- Parameters:
schema
- the schema of the messages to be senttopic
- the topic the producer will send messages to ornull
to use the default topicencryptionKeys
- the encryption keys used by the producer, replacing the default encryption keys ornull
to use the default encryption keys. Beware thatProducerBuilder
only hasProducerBuilder.addEncryptionKey(java.lang.String)
and doesn't have methods to replace the encryption keys.customizers
- the optional list of customizers to apply to the producer builder- Returns:
- the producer
- Throws:
org.apache.pulsar.client.api.PulsarClientException
- if any error occurs
-
getProducerConfig
Return a map of configuration options to use when creating producers.- Returns:
- the map of configuration options
-