Defining the flow

To define the flow within a single agent, you need to link the sources andsinks via a channel. You need to list the sources, sinks and channels for thegiven agent, and then point the source and sink to a channel. A source instancecan specify multiple channels, but a sink instance can only specify one channel.The format is as follows:

  1. # list the sources, sinks and channels for the agent
  2. <Agent>.sources = <Source>
  3. <Agent>.sinks = <Sink>
  4. <Agent>.channels = <Channel1> <Channel2>
  5.  
  6. # set channel for source
  7. <Agent>.sources.<Source>.channels = <Channel1> <Channel2> ...
  8.  
  9. # set channel for sink
  10. <Agent>.sinks.<Sink>.channel = <Channel1>

For example, an agent named agent_foo is reading data from an external avro client and sendingit to HDFS via a memory channel. The config file weblog.config could look like:

  1. # list the sources, sinks and channels for the agent
  2. agent_foo.sources = avro-appserver-src-1
  3. agent_foo.sinks = hdfs-sink-1
  4. agent_foo.channels = mem-channel-1
  5.  
  6. # set channel for source
  7. agent_foo.sources.avro-appserver-src-1.channels = mem-channel-1
  8.  
  9. # set channel for sink
  10. agent_foo.sinks.hdfs-sink-1.channel = mem-channel-1

This will make the events flow from avro-AppSrv-source to hdfs-Cluster1-sinkthrough the memory channel mem-channel-1. When the agent is started with theweblog.config as its config file, it will instantiate that flow.