Class PushPulsarSource<T>
- java.lang.Object
-
- org.apache.pulsar.functions.source.PulsarSource<T>
-
- org.apache.pulsar.functions.source.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>
-
-
Field Summary
-
Fields inherited from class org.apache.pulsar.functions.source.PulsarSource
functionClassLoader, properties, pulsarClient, pulsarSourceConfig, topicSchema
-
-
Constructor Summary
Constructors Constructor Description 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 Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidconsume(org.apache.pulsar.functions.api.Record<T> record)Attach a consumer function to this Source.intgetQueueLength()Get length of the queue that records are push onto Users can override this method to customize the queue lengthabstract voidopen(java.util.Map<java.lang.String,java.lang.Object> config, org.apache.pulsar.io.core.SourceContext sourceContext)Open connector with configuration.org.apache.pulsar.functions.api.Record<T>read()-
Methods inherited from class org.apache.pulsar.functions.source.PulsarSource
buildPulsarSourceConsumerConfig, buildRecord, createConsumeBuilder, getInputConsumers
-
-
-
-
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.ExceptionOpen connector with configuration.- Parameters:
config- initialization configsourceContext- 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
-
-