Package org.apache.pulsar.io.core
Interface BatchSourceTriggerer
@Public
@Evolving
public interface BatchSourceTriggerer
This is an interface for defining BatchSource triggerers. These triggerers trigger
the discovery method of the batch source that they are attached to. A BatchSource
is configured to use a particular BatchSource Triggerer at the time of job submission.
The interface and lifecycle is as follows
1. init - Called after the object is created by reflection.
- The triggerer is created on only one instance of the source job.
- The triggerer is passed its configuration in the init method.
- Trigger also has access to the SourceContext of the BatchSource that it is attached to.
It can use this context to get metadata information about the source as well things like secrets
- This method just inits the triggerer. It doesn't start its execution.
2. start - Is called to actually start the running of the triggerer.
- Triggerer will use the 'trigger' ConsumerFunction to actually trigger the discovery process
3. stop - Stop from further triggering discovers
-
Method Summary
-
Method Details
-
init
initializes the Triggerer with given config. Note that the triggerer doesn't start running until start is called.- Parameters:
config- config needed for triggerer to runsourceContext- The source context associated with the source The parameter passed to this trigger function is an optional description of the event that caused the trigger- Throws:
Exception- throws any exceptions when initializing
-
start
Triggerer should actually start looking out for trigger conditions.- Parameters:
trigger- The function to be called when its time to trigger the discover This function can be passed any metadata about this particular trigger event as its argument This method should return immediately. It is expected that implementations will use their own mechanisms to schedule the triggers.
-
stop
void stop()Triggerer should stop triggering.
-