flume-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shekhar sharma <shekhar2...@gmail.com>
Subject Setting headers for Exec Source in flume-NG-Problem in channel multipl
Date Tue, 24 Apr 2012 10:41:28 GMT
Hello,
i have just going through the  code of exec source, and when it is trying
to build the events, its getting the lines, converting to bytes and
creating a simple event.
The code is as follows:
void run()
{
 ------
--------
while ((line = reader.readLine()) != null) {
            counterGroup.incrementAndGet("exec.lines.read");

channelProcessor.processEvent(EventBuilder.withBody(line.getBytes()));

          }
}

Since i am using exec source, and trying to multiplex the channels, so
would it be ok to set the headers something like this?
Map<String,String> header = new HashMap<String,String>();
if(line.contains("item"))
  header.put("CustomerOrder",line)
else if(line.contains("cart")
   header.put("CustomerOrder",line)

And then while channel multiplexing i can use the configuration like:
agent.sources.r1.selector.type = multiplexing

agent.sources.r1.selector.header = CustomerOrder
agent.sources.r1.selector.mapping.<http://agent.sources.r1.selector.mapping.ca/>ITEM_VIEW=
Channel1

Please correct my understanding if its wrong.
The configuration "agent.sources.r1.selector.header = CustomerOrder" means
that source will check the "KEY" of the event header (CustomerOrder) and
agent.sources.r1.selector.mapping.<http://agent.sources.r1.selector.mapping.ca/>ITEM_VIEW=
Channel1, will look for the header "VALUE", if it is ITEM_VIEW_EVENT it
will send to channel1.


Regards,
Som

Mime
View raw message