Package org.apache.iotdb.pipe.api
Interface PipeProcessor
- All Superinterfaces:
AutoCloseable,PipePlugin
PipeProcessor
PipeProcessor is used to filter and transform the Event formed by the PipeExtractor.
The lifecycle of a PipeProcessor is as follows:
- When a collaboration task is created, the KV pairs of `WITH PROCESSOR` 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, PipeProcessorRuntimeConfiguration)will be called to config the runtime behavior of thePipeProcessor. - While the collaboration task is in progress:
PipeExtractorcaptures theEvents and wraps them into three types ofEventinstances.PipeProcessorprocesses theEventand then passes them to thePipeConnector. The following 3 methods will be called:process(TabletInsertionEvent, EventCollector),process(TsFileInsertionEvent, EventCollector)andprocess(Event, EventCollector).PipeConnectorserializes theEvents into binaries and send them to sinks.
- When the collaboration task is cancelled (the `DROP PIPE` command is executed), the
AutoCloseable.close()method will be called.
-
Method Summary
Modifier and TypeMethodDescriptionvoidcustomize(PipeParameters parameters, PipeProcessorRuntimeConfiguration configuration) This method is mainly used to customizePipeProcessor.voidprocess(TabletInsertionEvent tabletInsertionEvent, EventCollector eventCollector) This method is called to process theTabletInsertionEvent.default voidprocess(TsFileInsertionEvent tsFileInsertionEvent, EventCollector eventCollector) This method is called to process theTsFileInsertionEvent.voidprocess(Event event, EventCollector eventCollector) This method is called to process the genericEvent.voidvalidate(PipeParameterValidator validator) This method is mainly used to validatePipeParametersand it is executed beforecustomize(PipeParameters, PipeProcessorRuntimeConfiguration)is called.Methods inherited from interface java.lang.AutoCloseable
close
-
Method Details
-
validate
This method is mainly used to validatePipeParametersand it is executed beforecustomize(PipeParameters, PipeProcessorRuntimeConfiguration)is called.- Parameters:
validator- the validator used to validatePipeParameters- Throws:
Exception- if any parameter is not valid
-
customize
void customize(PipeParameters parameters, PipeProcessorRuntimeConfiguration configuration) throws Exception This method is mainly used to customizePipeProcessor. 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
PipeProcessorRuntimeConfiguration.
This method is called after the method
validate(PipeParameterValidator)is called and before the beginning of the events processing.- Parameters:
parameters- used to parse the inputPipeParametersentered by the userconfiguration- used to set the required properties of the runningPipeProcessor- Throws:
Exception- the user can throw errors if necessary
- Use
-
process
void process(TabletInsertionEvent tabletInsertionEvent, EventCollector eventCollector) throws Exception This method is called to process theTabletInsertionEvent.- Parameters:
tabletInsertionEvent-TabletInsertionEventto be processedeventCollector- used to collect result events after processing- Throws:
Exception- the user can throw errors if necessary
-
process
default void process(TsFileInsertionEvent tsFileInsertionEvent, EventCollector eventCollector) throws Exception This method is called to process theTsFileInsertionEvent.- Parameters:
tsFileInsertionEvent-TsFileInsertionEventto be processedeventCollector- used to collect result events after processing- Throws:
Exception- the user can throw errors if necessary
-
process
This method is called to process the genericEvent.
-