org.apache.flume
Interface Channel

All Superinterfaces:
LifecycleAware, NamedComponent
All Known Implementing Classes:
AbstractChannel, BasicChannelSemantics, FileChannel, JdbcChannel, MemoryChannel, PseudoTxnMemoryChannel

@InterfaceAudience.Public
@InterfaceStability.Stable
public interface Channel
extends LifecycleAware, NamedComponent

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 and take semantics. This is necessary to guarantee single hop reliability between agents. For instance, a source will successfully produce an event if and only if that event can be committed to the source's associated channel. Similarly, a sink will consume an event if and only if its respective endpoint 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.

Channels must be thread safe, protecting any internal invariants as no guarantees are given as to when and by how many sources/sinks they may be simultaneously accessed by.

See Also:
Source, Sink, Transaction

Method Summary
 Transaction getTransaction()
           
 void put(Event event)
          Puts the given event into the channel.
 Event take()
          Returns the next event from the channel if available.
 
Methods inherited from interface org.apache.flume.lifecycle.LifecycleAware
getLifecycleState, start, stop
 
Methods inherited from interface org.apache.flume.NamedComponent
getName, setName
 

Method Detail

put

void put(Event event)
         throws ChannelException

Puts the given event into 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 must 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.


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