Class PushPulsarSource<T>
java.lang.Object
org.apache.pulsar.functions.source.PulsarSource<T>
org.apache.pulsar.functions.source.PushPulsarSource<T>
- All Implemented Interfaces:
AutoCloseable,Source<T>
- Direct Known Subclasses:
MultiConsumerPulsarSource
-
Field Summary
Fields inherited from class org.apache.pulsar.functions.source.PulsarSource
functionClassLoader, properties, pulsarClient, pulsarSourceConfig, topicSchema -
Constructor Summary
ConstructorsConstructorDescriptionPushPulsarSource(org.apache.pulsar.client.api.PulsarClient pulsarClient, PulsarSourceConfig pulsarSourceConfig, Map<String, String> properties, ClassLoader functionClassLoader) -
Method Summary
Modifier and TypeMethodDescriptionvoidAttach a consumer function to this Source.intGet length of the queue that records are push onto Users can override this method to customize the queue length.abstract voidopen(Map<String, Object> config, SourceContext sourceContext) Open connector with configuration.read()Methods inherited from class org.apache.pulsar.functions.source.PulsarSource
buildPulsarSourceConsumerConfig, buildRecord, createConsumeBuilder, getInputConsumersMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.AutoCloseable
close
-
Constructor Details
-
PushPulsarSource
public PushPulsarSource(org.apache.pulsar.client.api.PulsarClient pulsarClient, PulsarSourceConfig pulsarSourceConfig, Map<String, String> properties, ClassLoader functionClassLoader)
-
-
Method Details
-
read
- Throws:
Exception
-
open
Open connector with configuration.- Parameters:
config- initialization configsourceContext- environment where the source connector is running- Throws:
Exception- IO type exceptions when opening a connector
-
consume
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
-