flume custom Interceptor
Implement an interface
接口:org.apache.flume.interceptor.Interceptor
方法1:Event intercept(Event var1);
Event processing is a data structure flume data message byte to the presence of body Event
The method enables the processing logic for each message, to be achieved.
方法2:List<Event> intercept(List<Event> var1);
The method enables the processing of a batch message, when the batch is Flume pull message will be processed by this method must be implemented
Interceptor provide examples of access
public static class Builder implements Interceptor.Builder { public Interceptor build() { return new SimpleDataTransformInterceptor(); } public void configure(Context context) { } }
Builder must be achieved in our internal Interceptor class as an inner class
Configuration takes effect
a${agent_name}.sources.${source_name}.interceptors = ${interceptor_name}
${agent_name}.interceptors.${interceptor_name}.type=com.test.interceptor.MyInterceptor$Builder