flume-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shekhar sharma <shekhar2...@gmail.com>
Subject Re: Create custom sink
Date Tue, 04 Sep 2012 05:42:33 GMT
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
<joaoricardoascenso@gmail.com>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
>

Mime
View raw message