org.apache.flume.agent.embedded
Class EmbeddedAgent

java.lang.Object
  extended by org.apache.flume.agent.embedded.EmbeddedAgent

@InterfaceAudience.Public
@InterfaceStability.Stable
public class EmbeddedAgent
extends Object

EmbeddedAgent gives Flume users the ability to embed simple agents in applications. This Agent is mean to be much simpler than a traditional agent and as such it's more restrictive than what can be configured for a traditional agent. For specifics see the Flume User Guide.


Constructor Summary
EmbeddedAgent(String name)
           
 
Method Summary
 void configure(Map<String,String> properties)
          Configures the embedded agent.
 void put(Event event)
          Adds event to the channel owned by the agent.
 void putAll(List<Event> events)
          Adds events to the channel owned by the agent.
 void start()
          Started the agent.
 void stop()
          Stops the agent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmbeddedAgent

public EmbeddedAgent(String name)
Method Detail

configure

public void configure(Map<String,String> properties)
               throws FlumeException
Configures the embedded agent. Can only be called after the object is created or after the stop() method is called.

Parameters:
properties - source, channel, and sink group configuration
Throws:
FlumeException - if a component is unable to be found or configured
IllegalStateException - if called while the agent is started

start

public void start()
           throws FlumeException
Started the agent. Can only be called after a successful call to configure().

Throws:
FlumeException - if a component cannot be started
IllegalStateException - if the agent has not been configured or is already started

stop

public void stop()
          throws FlumeException
Stops the agent. Can only be called after a successful call to start(). After a call to stop(), the agent can be re-configured with the configure() method or re-started with the start() method.

Throws:
FlumeException - if a component cannot be stopped
IllegalStateException - if the agent is not started

put

public void put(Event event)
         throws EventDeliveryException
Adds event to the channel owned by the agent. Note however, that the event is not copied and as such, the byte array and headers cannot be re-used by the caller.

Parameters:
event -
Throws:
EventDeliveryException - if unable to add event to channel

putAll

public void putAll(List<Event> events)
            throws EventDeliveryException
Adds events to the channel owned by the agent. Note however, that the event is not copied and as such, the byte array and headers cannot be re-used by the caller.

Parameters:
events -
Throws:
EventDeliveryException - if unable to add event to channel


Copyright © 2009-2013 Apache Software Foundation. All Rights Reserved.