org.apache.flume
Interface Channel

All Known Implementing Classes:
FanoutChannel, FileChannel, JdbcChannel, MemoryChannel, PseudoTxnMemoryChannel

public interface Channel

A channel connects a Source to a Sink. The source acts as producer while the sink acts as a consumer of events. The channel itself is the buffer between the two.

A channel exposes a Transaction interface that can be used by its clients to ensure atomic put or remove semantics. This is necessary to guarantee single hop reliability in a logical node. For instance, a source will produce an event successfully if and only if it can be committed to the channel. Similarly, a sink will consume an event if and only if its end point can accept the event. The extent of transaction support varies for different channel implementations ranging from strong to best-effort semantics.

Channels are associated with unique names that can be used for separating configuration and working namespaces.

See Also:
org.apache.flume.EventSource, org.apache.flume.EventSink, Transaction

Method Summary
 String getName()
           
 Transaction getTransaction()
           
 void put(Event event)
          Puts the given event in the channel.
 void shutdown()
          Instructs the channel to release any resources held in preparation of shutting down.
 Event take()
          Returns the next event from the channel if available.
 

Method Detail

put

void put(Event event)
         throws ChannelException

Puts the given event in the channel.

Note: This method must be invoked within an active Transaction boundary. Failure to do so can lead to unpredictable results.

Parameters:
event - the event to transport.
Throws:
ChannelException - in case this operation fails.
See Also:
Transaction.begin()

take

Event take()
           throws ChannelException

Returns the next event from the channel if available. If the channel does not have any events available, this method would return null.

Note: This method must be invoked within an active Transaction boundary. Failure to do so can lead to unpredictable results.

Returns:
the next available event or null if no events are available.
Throws:
ChannelException - in case this operation fails.
See Also:
Transaction.begin()

getTransaction

Transaction getTransaction()
Returns:
the transaction instance associated with this channel.

shutdown

void shutdown()
Instructs the channel to release any resources held in preparation of shutting down.


getName

String getName()
Returns:
the channel name.


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