Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Flume, mail # user - can anybody please tell me how to create custome interceptor


+
Prajakta Bavikar 2012-09-13, 06:51
+
Ashutosh Panigrahi 2012-09-13, 07:21
Copy link to this message
-
Re: can anybody please tell me how to create custome interceptor
Juhani Connolly 2012-09-14, 01:34
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
> <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> 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.
>>
>