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

Switch to Threaded View
Flume, mail # user - Create custom sink


Copy link to this message
-
Re: Create custom sink
shekhar sharma 2012-09-04, 05:42
Its pretty straight forward!! You need to create a class extending from
Abstract Sink and override the process method..

For example:
public class MyCustomSink extends AbstractSink {
public MyCustomSink()
{
    //Your initialization code goes here..Constructor is called when you
start agent

}

@Override
  public Status process() throws EventDeliveryException {
    Status result = Status.READY;
Channel channel = getChannel();
    Transaction transaction = channel.getTransaction();
    Event event = null;
    try
 {
     transaction.begin();
    event = channel.take();
   ///Now you are ready to process the event

}

}
In the host properties file you need to mentioned the full class
name..com.mycom.MyCustomSink

On Tue, Sep 4, 2012 at 2:22 AM, João Ascenso
<[EMAIL PROTECTED]>wrote:

> Greetings,
>
> I'm looking to implement my own sink, is there a good tutorial on how one
> should build the .jar and integrate with flume? I can only find tutorials
> to versions lower than 1.x and i cant find a source saying that way is
> still valid
>
>
> Thanks in advance,
> João Ascenso
>