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
  • Method Details

    • createConsumer

      org.apache.pulsar.client.api.Consumer<T> createConsumer(org.apache.pulsar.client.api.Schema<T> schema) throws org.apache.pulsar.client.api.PulsarClientException
      Create a consumer.
      Parameters:
      schema - the schema of the messages to be sent
      Returns:
      the consumer
      Throws:
      org.apache.pulsar.client.api.PulsarClientException - if any error occurs
    • createConsumer

      org.apache.pulsar.client.api.Consumer<T> createConsumer(org.apache.pulsar.client.api.Schema<T> schema, @Nullable Collection<String> topics) throws org.apache.pulsar.client.api.PulsarClientException
      Create a consumer.
      Parameters:
      schema - the schema of the messages to be sent
      topics - the topics the consumer will subscribe to overriding the default ones or null to use the default topics
      Returns:
      the consumer
      Throws:
      org.apache.pulsar.client.api.PulsarClientException - if any error occurs
    • createConsumer

      org.apache.pulsar.client.api.Consumer<T> createConsumer(org.apache.pulsar.client.api.Schema<T> schema, @Nullable Collection<String> topics, @Nullable Map<String,String> properties, @Nullable List<ConsumerBuilderCustomizer<T>> customizers) throws org.apache.pulsar.client.api.PulsarClientException
      Create a consumer.
      Parameters:
      schema - the schema of the messages to be sent
      topics - the topics the consumer will subscribe to overriding the default ones or null to use the default topics. Beware that using ConsumerBuilder.topic(java.lang.String...) or ConsumerBuilder.topics(java.util.List<java.lang.String>) will add to the default topics, not override them.
      properties - the metadata properties to attach to the consumer, replacing the default metadata properties, or null to use the default metadata properties. Beware that using ConsumerBuilder.property(java.lang.String, java.lang.String) or ConsumerBuilder.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
      Returns:
      the consumer
      Throws:
      org.apache.pulsar.client.api.PulsarClientException - if any error occurs
    • getConsumerConfig

      Map<String,Object> getConsumerConfig()
      Return the configuration options to use when creating consumers.
      Returns:
      the configuration options