Package org.apache.beam.sdk.io.pulsar
Class NaiveReadFromPulsarDoFn<T>
java.lang.Object
org.apache.beam.sdk.transforms.DoFn<PulsarSourceDescriptor,T>
org.apache.beam.sdk.io.pulsar.NaiveReadFromPulsarDoFn<T>
- All Implemented Interfaces:
Serializable,HasDisplayData
DoFn for reading from Apache Pulsar based on Pulsar
Reader from the start message id. It
does not support split or acknowledge message get read.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.beam.sdk.transforms.DoFn
DoFn.AlwaysFetched, DoFn.BoundedPerElement, DoFn.BundleFinalizer, DoFn.Element, DoFn.FieldAccess, DoFn.FinishBundle, DoFn.FinishBundleContext, DoFn.GetInitialRestriction, DoFn.GetInitialWatermarkEstimatorState, DoFn.GetRestrictionCoder, DoFn.GetSize, DoFn.GetWatermarkEstimatorStateCoder, DoFn.Key, DoFn.MultiOutputReceiver, DoFn.NewTracker, DoFn.NewWatermarkEstimator, DoFn.OnTimer, DoFn.OnTimerContext, DoFn.OnTimerFamily, DoFn.OnWindowExpiration, DoFn.OnWindowExpirationContext, DoFn.OutputReceiver<T>, DoFn.ProcessContext, DoFn.ProcessContinuation, DoFn.ProcessElement, DoFn.RequiresStableInput, DoFn.RequiresTimeSortedInput, DoFn.Restriction, DoFn.Setup, DoFn.SideInput, DoFn.SplitRestriction, DoFn.StartBundle, DoFn.StartBundleContext, DoFn.StateId, DoFn.Teardown, DoFn.TimerFamily, DoFn.TimerId, DoFn.Timestamp, DoFn.TruncateRestriction, DoFn.UnboundedPerElement, DoFn.WatermarkEstimatorState, DoFn.WindowedContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetInitialRestriction(PulsarSourceDescriptor pulsarSource) getInitialWatermarkEstimatorState(Instant currentElementTimestamp) doublegetSize(PulsarSourceDescriptor pulsarSource, OffsetRange range) voidOpen connection to Pulsar clients.org.apache.pulsar.client.api.Reader<byte[]> newWatermarkEstimator(Instant watermarkEstimatorState) processElement(PulsarSourceDescriptor pulsarSourceDescriptor, RestrictionTracker<OffsetRange, Long> tracker, WatermarkEstimator<Instant> watermarkEstimator, DoFn.OutputReceiver<T> output) restrictionTracker(PulsarSourceDescriptor pulsarSource, OffsetRange restriction) voidsplitRestriction(OffsetRange restriction, DoFn.OutputReceiver<OffsetRange> receiver, PipelineOptions unused) voidteardown()Close connection to Pulsar clients.Methods inherited from class org.apache.beam.sdk.transforms.DoFn
getAllowedTimestampSkew, getInputTypeDescriptor, getOutputTypeDescriptor, populateDisplayData, prepareForProcessing
-
Constructor Details
-
NaiveReadFromPulsarDoFn
-
-
Method Details
-
initPulsarClients
Open connection to Pulsar clients.- Throws:
Exception
-
teardown
Close connection to Pulsar clients.- Throws:
Exception
-
getInitialRestriction
@GetInitialRestriction public OffsetRange getInitialRestriction(@Element PulsarSourceDescriptor pulsarSource) -
getSize
@GetSize public double getSize(@Element PulsarSourceDescriptor pulsarSource, @Restriction OffsetRange range) -
newReader
public org.apache.pulsar.client.api.Reader<byte[]> newReader(org.apache.pulsar.client.api.PulsarClient client, String topicPartition) throws org.apache.pulsar.client.api.PulsarClientException - Throws:
org.apache.pulsar.client.api.PulsarClientException
-
getRestrictionCoder
-
processElement
@ProcessElement public DoFn.ProcessContinuation processElement(@Element PulsarSourceDescriptor pulsarSourceDescriptor, RestrictionTracker<OffsetRange, Long> tracker, WatermarkEstimator<Instant> watermarkEstimator, DoFn.OutputReceiver<T> output) throws IOException- Throws:
IOException
-
splitRestriction
@SplitRestriction public void splitRestriction(@Restriction OffsetRange restriction, DoFn.OutputReceiver<OffsetRange> receiver, PipelineOptions unused) -
getInitialWatermarkEstimatorState
@GetInitialWatermarkEstimatorState public Instant getInitialWatermarkEstimatorState(@Timestamp Instant currentElementTimestamp) -
newWatermarkEstimator
@NewWatermarkEstimator public WatermarkEstimator<Instant> newWatermarkEstimator(@WatermarkEstimatorState Instant watermarkEstimatorState) -
restrictionTracker
@NewTracker public OffsetRangeTracker restrictionTracker(@Element PulsarSourceDescriptor pulsarSource, @Restriction OffsetRange restriction)
-