Class PushPulsarSource<T>

  • All Implemented Interfaces:
    java.lang.AutoCloseable, org.apache.pulsar.io.core.Source<T>
    Direct Known Subclasses:
    MultiConsumerPulsarSource

    public abstract class PushPulsarSource<T>
    extends PulsarSource<T>
    • Constructor Detail

      • PushPulsarSource

        public PushPulsarSource​(org.apache.pulsar.client.api.PulsarClient pulsarClient,
                                PulsarSourceConfig pulsarSourceConfig,
                                java.util.Map<java.lang.String,​java.lang.String> properties,
                                java.lang.ClassLoader functionClassLoader)
    • Method Detail

      • read

        public org.apache.pulsar.functions.api.Record<T> read()
                                                       throws java.lang.Exception
        Throws:
        java.lang.Exception
      • open

        public abstract void open​(java.util.Map<java.lang.String,​java.lang.Object> config,
                                  org.apache.pulsar.io.core.SourceContext sourceContext)
                           throws java.lang.Exception
        Open connector with configuration.
        Parameters:
        config - initialization config
        sourceContext - environment where the source connector is running
        Throws:
        java.lang.Exception - IO type exceptions when opening a connector
      • consume

        public void consume​(org.apache.pulsar.functions.api.Record<T> record)
        Attach a consumer function to this Source. This is invoked by the implementation to pass messages whenever there is data to be pushed to Pulsar.
        Parameters:
        record - next message from source which should be sent to a Pulsar topic
      • getQueueLength

        public int getQueueLength()
        Get length of the queue that records are push onto Users can override this method to customize the queue length
        Returns:
        queue length