flume-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juhani Connolly <juhani_conno...@cyberagent.co.jp>
Subject Re: can anybody please tell me how to create custome interceptor
Date Fri, 14 Sep 2012 01:34:12 GMT
As you said, putting the FQCN of the builder in the props file works, 
and I would consider it the recommended method when working with custom 
extensions(as you do not need to rebuild flume, and can distribute your 
added sources/interceptors separately, and upgrade versions without 
having to rebuild  each time).

You can do this by just compiling your addons separately, putting the 
flume jar on the classpath for your compiler. Then put the resulting 
class files/jar file somewhere, and add that to the flume classpath in 
flume-env.sh. Then putting the builder fqcn in the type field for the 
interceptor will work and you didn't have to mess with the original 
sources at all.

On 09/13/2012 04:21 PM, Ashutosh Panigrahi wrote:
> Your custom interceptor should implement the interface Interceptor , 
> (org.apache.flume.interceptor.Interceptor) and should write a builder 
> implementing Interceptor.Builder
> Put your logic inside the intercept method of the interface  (Populate 
> some headers).
> If you are modifying the existing source code then , Register your 
> interceptor inside the enum InterceptorType. ( I modify the flume 
> source code itself , so has registered there). e.g The entry for 
> timestamp interceptor looks like this
> *TIMESTAMP(org.apache.flume.interceptor.TimestampInterceptor.Builder.class)*
> If you are extending the flume source , then i feel giving the FQCN of 
> the builder class in the properties file should work. Never tested 
> though.
> Regards
> Ashutosh
> On 13-Sep-2012, at 12:21 PM, Prajakta Bavikar 
> <Prajakta_Bavikar@persistent.co.in 
> <mailto:Prajakta_Bavikar@persistent.co.in>> wrote:
>> It will be very helpful if I get some sample for custom interceptor.
>> Or some steps to follow..
>> -Prajakta
>> DISCLAIMER ========== This e-mail may contain privileged and 
>> confidential information which is the property of Persistent Systems 
>> Ltd. It is intended only for the use of the individual or entity to 
>> which it is addressed. If you are not the intended recipient, you are 
>> not authorized to read, retain, copy, print, distribute or use this 
>> message. If you have received this communication in error, please 
>> notify the sender and delete all copies of this message. Persistent 
>> Systems Ltd. does not accept any liability for virus infected mails.

View raw message