Package org.apache.iotdb.pipe.api
Interface PipeSource
- All Superinterfaces:
AutoCloseable,PipeExtractor,PipePlugin
PipeSource
PipeSource is responsible for capturing Events from sources.
Various data sources can be supported by implementing different PipeSource classes.
The lifecycle of a PipeSource is as follows:
- When a collaboration task is created, the KV pairs of `WITH EXTRACTOR` clause in SQL are
parsed and the validation method
validate(PipeParameterValidator)will be called to validate thePipeParameters. - Before the collaboration task starts, the method
customize(PipeParameters, PipeSourceRuntimeConfiguration)will be called to configure the runtime behavior of thePipeSource. - Then the method
start()will be called to start thePipeSource. - While the collaboration task is in progress, the method
supply()will be called to captureEvents from sources and then theEvents will be passed to thePipeProcessor. - The method
AutoCloseable.close()will be called when the collaboration task is cancelled (the `DROP PIPE` command is executed).
-
Method Summary
Modifier and TypeMethodDescriptionvoidcustomize(PipeParameters parameters, PipeSourceRuntimeConfiguration configuration) This method is mainly used to customizePipeSource.voidstart()Start thePipeSource.supply()voidvalidate(PipeParameterValidator validator) This method is mainly used to validatePipeParametersand it is executed beforecustomize(PipeParameters, PipeSourceRuntimeConfiguration)is called.Methods inherited from interface java.lang.AutoCloseable
closeMethods inherited from interface org.apache.iotdb.pipe.api.PipeExtractor
customize
-
Method Details
-
validate
This method is mainly used to validatePipeParametersand it is executed beforecustomize(PipeParameters, PipeSourceRuntimeConfiguration)is called.- Specified by:
validatein interfacePipeExtractor- Parameters:
validator- the validator used to validatePipeParameters- Throws:
Exception- if anyPipeParametersis invalid
-
customize
void customize(PipeParameters parameters, PipeSourceRuntimeConfiguration configuration) throws Exception This method is mainly used to customizePipeSource. In this method, the user can do the following things:- Use
PipeParametersto parse key-value pair attributes entered by the user. - Set the running configurations in
PipeSourceRuntimeConfiguration.
This method is called after the method
validate(PipeParameterValidator)is called.- Parameters:
parameters- used to parse the inputPipeParametersentered by the userconfiguration- used to set the required properties of the runningPipeSource- Throws:
Exception- the user can throw errors if necessary
- Use
-
start
Start thePipeSource. After this method is called,Events should be ready to be supplied bysupply(). This method is called aftercustomize(PipeParameters, PipeSourceRuntimeConfiguration)is called.- Specified by:
startin interfacePipeExtractor- Throws:
Exception- the user can throw errors if necessary
-
supply
Supply singleEventfrom thePipeSourceand the caller will send theEventto thePipeProcessor. This method is called afterstart()is called.- Specified by:
supplyin interfacePipeExtractor- Returns:
- the
Eventto be supplied. theEventmay benullif thePipeSourcehas no moreEvents at the moment, but thePipeSourceis still running for moreEvents. - Throws:
Exception- the user can throw errors if necessary
-