Class AbstractPulsarProducerProcessor<T>

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

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

    • MSG_COUNT

      public static final String MSG_COUNT
      See Also:
    • TOPIC_NAME

      public static final String TOPIC_NAME
      See Also:
    • COMPRESSION_TYPE_NONE

      static final org.apache.nifi.components.AllowableValue COMPRESSION_TYPE_NONE
    • COMPRESSION_TYPE_LZ4

      static final org.apache.nifi.components.AllowableValue COMPRESSION_TYPE_LZ4
    • COMPRESSION_TYPE_ZLIB

      static final org.apache.nifi.components.AllowableValue COMPRESSION_TYPE_ZLIB
    • MESSAGE_ROUTING_MODE_CUSTOM_PARTITION

      static final org.apache.nifi.components.AllowableValue MESSAGE_ROUTING_MODE_CUSTOM_PARTITION
    • MESSAGE_ROUTING_MODE_ROUND_ROBIN_PARTITION

      static final org.apache.nifi.components.AllowableValue MESSAGE_ROUTING_MODE_ROUND_ROBIN_PARTITION
    • MESSAGE_ROUTING_MODE_SINGLE_PARTITION

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

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

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

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

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

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

      public static final org.apache.nifi.components.PropertyDescriptor MAX_ASYNC_REQUESTS
    • 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
    • BATCHING_ENABLED

      public static final org.apache.nifi.components.PropertyDescriptor BATCHING_ENABLED
    • BATCHING_MAX_BYTES

      public static final org.apache.nifi.components.PropertyDescriptor BATCHING_MAX_BYTES
    • BATCHING_MAX_MESSAGES

      public static final org.apache.nifi.components.PropertyDescriptor BATCHING_MAX_MESSAGES
    • BATCH_INTERVAL

      public static final org.apache.nifi.components.PropertyDescriptor BATCH_INTERVAL
    • BLOCK_IF_QUEUE_FULL

      public static final org.apache.nifi.components.PropertyDescriptor BLOCK_IF_QUEUE_FULL
    • COMPRESSION_TYPE

      public static final org.apache.nifi.components.PropertyDescriptor COMPRESSION_TYPE
    • CHUNKING_ENABLED

      public static final org.apache.nifi.components.PropertyDescriptor CHUNKING_ENABLED
    • CHUNK_MAX_MESSAGE_SIZE

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

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

      public static final org.apache.nifi.components.PropertyDescriptor MESSAGE_ROUTING_MODE
    • PENDING_MAX_MESSAGES

      public static final org.apache.nifi.components.PropertyDescriptor PENDING_MAX_MESSAGES
    • MAPPED_MESSAGE_PROPERTIES

      public static final org.apache.nifi.components.PropertyDescriptor MAPPED_MESSAGE_PROPERTIES
    • MESSAGE_KEY

      public static final org.apache.nifi.components.PropertyDescriptor MESSAGE_KEY
    • 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
    • producers

      private PulsarConsumerLRUCache<String,org.apache.pulsar.client.api.Producer<T>> producers
    • publisherPool

      private ExecutorService publisherPool
    • canPublish

      protected AtomicBoolean canPublish
    • trackFailures

      protected AtomicBoolean trackFailures
    • workQueue

      protected BlockingQueue<MessageTuple<T>> workQueue
    • failureQueue

      protected BlockingQueue<MessageTuple<T>> failureQueue
    • asyncPublishers

  • Constructor Details

    • AbstractPulsarProducerProcessor

      public AbstractPulsarProducerProcessor()
  • 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
    • 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)
    • handleFailures

      protected void handleFailures(org.apache.nifi.processor.ProcessSession session)
      If the processor is configured to run in asynchronous mode, then we need to periodically check the failureList and route those records to the FAILURE relationship, so that the end user is aware of the failures and can handle them as they see fit.
      Parameters:
      session - - The current processor session
    • getAsyncPublishers

      private List<AbstractPulsarProducerProcessor<T>.AsyncPublisher> getAsyncPublishers()
    • setAsyncPublishers

      private void setAsyncPublishers(List<AbstractPulsarProducerProcessor<T>.AsyncPublisher> list)
    • getProducer

      protected org.apache.pulsar.client.api.Producer<T> getProducer(org.apache.nifi.processor.ProcessContext context, String topic)
    • getBuilder

      private org.apache.pulsar.client.api.ProducerBuilder<T> getBuilder(org.apache.nifi.processor.ProcessContext context, String topic)
    • getPulsarClientService

      protected PulsarClientService getPulsarClientService()
    • setPulsarClientService

      protected void setPulsarClientService(PulsarClientService pulsarClientService)
    • getProducers

      protected PulsarConsumerLRUCache<String,org.apache.pulsar.client.api.Producer<T>> getProducers()
    • setProducers

      protected void setProducers(PulsarConsumerLRUCache<String,org.apache.pulsar.client.api.Producer<T>> producers)
    • getPublisherPool

      protected ExecutorService getPublisherPool()
    • setPublisherPool

      protected void setPublisherPool(ExecutorService publisherPool)
    • getMessageKey

      protected String getMessageKey(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.flowfile.FlowFile ff)
    • getMappedMessageProperties

      protected Map<String,String> getMappedMessageProperties(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.flowfile.FlowFile ff)
    • send

      protected org.apache.pulsar.client.api.MessageId send(org.apache.pulsar.client.api.Producer<T> producer, String key, Map<String,String> properties, T value) throws org.apache.pulsar.client.api.PulsarClientException
      Throws:
      org.apache.pulsar.client.api.PulsarClientException