Class AbstractPulsarConsumerProcessor<T>

java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processor.AbstractProcessor
org.apache.nifi.processors.pulsar.AbstractPulsarConsumerProcessor<T>
All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent, org.apache.nifi.processor.Processor
Direct Known Subclasses:
ConsumePulsar, ConsumePulsarRecord

public abstract class AbstractPulsarConsumerProcessor<T> extends org.apache.nifi.processor.AbstractProcessor
  • Field Details

    • PULSAR_MESSAGE_KEY

      protected static final String PULSAR_MESSAGE_KEY
      See Also:
    • EXCLUSIVE

      protected static final org.apache.nifi.components.AllowableValue EXCLUSIVE
    • KEY_SHARED

      protected static final org.apache.nifi.components.AllowableValue KEY_SHARED
    • SHARED

      protected static final org.apache.nifi.components.AllowableValue SHARED
    • FAILOVER

      protected static final org.apache.nifi.components.AllowableValue FAILOVER
    • CONSUME

      static final org.apache.nifi.components.AllowableValue CONSUME
    • DISCARD

      static final org.apache.nifi.components.AllowableValue DISCARD
    • FAIL

      static final org.apache.nifi.components.AllowableValue FAIL
    • OFFSET_EARLIEST

      static final org.apache.nifi.components.AllowableValue OFFSET_EARLIEST
    • OFFSET_LATEST

      static final org.apache.nifi.components.AllowableValue OFFSET_LATEST
    • REL_SUCCESS

      public static final org.apache.nifi.processor.Relationship REL_SUCCESS
    • PULSAR_CLIENT_SERVICE

      public static final org.apache.nifi.components.PropertyDescriptor PULSAR_CLIENT_SERVICE
    • TOPICS

      public static final org.apache.nifi.components.PropertyDescriptor TOPICS
    • TOPICS_PATTERN

      public static final org.apache.nifi.components.PropertyDescriptor TOPICS_PATTERN
    • SUBSCRIPTION_NAME

      public static final org.apache.nifi.components.PropertyDescriptor SUBSCRIPTION_NAME
    • SUBSCRIPTION_INITIAL_POSITION

      public static final org.apache.nifi.components.PropertyDescriptor SUBSCRIPTION_INITIAL_POSITION
    • ASYNC_ENABLED

      public static final org.apache.nifi.components.PropertyDescriptor ASYNC_ENABLED
    • AUTO_UPDATE_PARTITIONS

      public static final org.apache.nifi.components.PropertyDescriptor AUTO_UPDATE_PARTITIONS
    • AUTO_UPDATE_PARTITION_INTERVAL

      public static final org.apache.nifi.components.PropertyDescriptor AUTO_UPDATE_PARTITION_INTERVAL
    • MAX_ASYNC_REQUESTS

      public static final org.apache.nifi.components.PropertyDescriptor MAX_ASYNC_REQUESTS
    • ACK_TIMEOUT

      public static final org.apache.nifi.components.PropertyDescriptor ACK_TIMEOUT
    • EXPIRE_TIME_OF_INCOMPLETE_CHUNKED_MESSAGE

      public static final org.apache.nifi.components.PropertyDescriptor EXPIRE_TIME_OF_INCOMPLETE_CHUNKED_MESSAGE
    • AUTO_ACK_OLDEST_CHUNKED_ON_QUEUE_FULL

      public static final org.apache.nifi.components.PropertyDescriptor AUTO_ACK_OLDEST_CHUNKED_ON_QUEUE_FULL
    • MAX_PENDING_CHUNKED_MESSAGE

      public static final org.apache.nifi.components.PropertyDescriptor MAX_PENDING_CHUNKED_MESSAGE
    • CONSUMER_NAME

      public static final org.apache.nifi.components.PropertyDescriptor CONSUMER_NAME
    • PRIORITY_LEVEL

      public static final org.apache.nifi.components.PropertyDescriptor PRIORITY_LEVEL
    • RECEIVER_QUEUE_SIZE

      public static final org.apache.nifi.components.PropertyDescriptor RECEIVER_QUEUE_SIZE
    • SUBSCRIPTION_TYPE

      public static final org.apache.nifi.components.PropertyDescriptor SUBSCRIPTION_TYPE
    • MESSAGE_DEMARCATOR

      public static final org.apache.nifi.components.PropertyDescriptor MESSAGE_DEMARCATOR
    • CONSUMER_BATCH_SIZE

      public static final org.apache.nifi.components.PropertyDescriptor CONSUMER_BATCH_SIZE
    • MAPPED_FLOWFILE_ATTRIBUTES

      public static final org.apache.nifi.components.PropertyDescriptor MAPPED_FLOWFILE_ATTRIBUTES
    • REPLICATE_SUBSCRIPTION_STATE

      public static final org.apache.nifi.components.PropertyDescriptor REPLICATE_SUBSCRIPTION_STATE
    • PROPERTIES

      protected static final List<org.apache.nifi.components.PropertyDescriptor> PROPERTIES
    • RELATIONSHIPS

      protected static final Set<org.apache.nifi.processor.Relationship> RELATIONSHIPS
    • pulsarClientService

      private PulsarClientService pulsarClientService
    • consumers

      private PulsarConsumerLRUCache<String,org.apache.pulsar.client.api.Consumer<org.apache.pulsar.client.api.schema.GenericRecord>> consumers
    • consumerPool

      private ExecutorService consumerPool
    • consumerService

      private ExecutorCompletionService<List<org.apache.pulsar.client.api.Message<org.apache.pulsar.client.api.schema.GenericRecord>>> consumerService
    • ackPool

      private ExecutorService ackPool
    • ackService

      private ExecutorCompletionService<Object> ackService
  • Constructor Details

    • AbstractPulsarConsumerProcessor

      public AbstractPulsarConsumerProcessor()
  • Method Details

    • getRelationships

      public Set<org.apache.nifi.processor.Relationship> getRelationships()
      Specified by:
      getRelationships in interface org.apache.nifi.processor.Processor
      Overrides:
      getRelationships in class org.apache.nifi.processor.AbstractSessionFactoryProcessor
    • getSupportedPropertyDescriptors

      protected List<org.apache.nifi.components.PropertyDescriptor> getSupportedPropertyDescriptors()
      Overrides:
      getSupportedPropertyDescriptors in class org.apache.nifi.components.AbstractConfigurableComponent
    • customValidate

      protected Collection<org.apache.nifi.components.ValidationResult> customValidate(org.apache.nifi.components.ValidationContext validationContext)
      Overrides:
      customValidate in class org.apache.nifi.components.AbstractConfigurableComponent
    • init

      @OnScheduled public void init(org.apache.nifi.processor.ProcessContext context)
    • shutDown

      @OnUnscheduled public void shutDown(org.apache.nifi.processor.ProcessContext context)
    • cleanUp

      @OnStopped public void cleanUp(org.apache.nifi.processor.ProcessContext context)
    • getConsumerId

      protected String getConsumerId(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.flowfile.FlowFile flowFile)
      Method returns a string that uniquely identifies a consumer by concatenating the topic name and subscription properties together.
      Parameters:
      context - - The Processor context
      flowFile - - The current NiFi flow file
      Returns:
      The consumer id.
    • consumeAsync

      protected void consumeAsync(org.apache.pulsar.client.api.Consumer<org.apache.pulsar.client.api.schema.GenericRecord> consumer, org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) throws org.apache.pulsar.client.api.PulsarClientException
      Throws:
      org.apache.pulsar.client.api.PulsarClientException
    • getConsumer

      protected org.apache.pulsar.client.api.Consumer<org.apache.pulsar.client.api.schema.GenericRecord> getConsumer(org.apache.nifi.processor.ProcessContext context, String topic) throws org.apache.pulsar.client.api.PulsarClientException
      Throws:
      org.apache.pulsar.client.api.PulsarClientException
    • getConsumerBuilder

      protected org.apache.pulsar.client.api.ConsumerBuilder<org.apache.pulsar.client.api.schema.GenericRecord> getConsumerBuilder(org.apache.nifi.processor.ProcessContext context) throws org.apache.pulsar.client.api.PulsarClientException
      Throws:
      org.apache.pulsar.client.api.PulsarClientException
    • getConsumerPool

      protected ExecutorService getConsumerPool()
    • setConsumerPool

      protected void setConsumerPool(ExecutorService pool)
    • getConsumerService

      protected ExecutorCompletionService<List<org.apache.pulsar.client.api.Message<org.apache.pulsar.client.api.schema.GenericRecord>>> getConsumerService()
    • setConsumerService

      protected void setConsumerService(ExecutorCompletionService<List<org.apache.pulsar.client.api.Message<org.apache.pulsar.client.api.schema.GenericRecord>>> service)
    • getAckPool

      protected ExecutorService getAckPool()
    • setAckPool

      protected void setAckPool(ExecutorService pool)
    • getAckService

      protected ExecutorCompletionService<Object> getAckService()
    • setAckService

      protected void setAckService(ExecutorCompletionService<Object> ackService)
    • getPulsarClientService

      protected PulsarClientService getPulsarClientService()
    • setPulsarClientService

      protected void setPulsarClientService(PulsarClientService pulsarClientService)
    • getConsumers

      protected PulsarConsumerLRUCache<String,org.apache.pulsar.client.api.Consumer<org.apache.pulsar.client.api.schema.GenericRecord>> getConsumers()
    • setConsumers

      protected void setConsumers(PulsarConsumerLRUCache<String,org.apache.pulsar.client.api.Consumer<org.apache.pulsar.client.api.schema.GenericRecord>> consumers)
    • getMappedFlowFileAttributes

      protected Map<String,String> getMappedFlowFileAttributes(org.apache.nifi.processor.ProcessContext context, org.apache.pulsar.client.api.Message<org.apache.pulsar.client.api.schema.GenericRecord> msg)
    • isSharedSubscription

      protected boolean isSharedSubscription(org.apache.nifi.processor.ProcessContext context)