org.apache.flume.channel
Class PseudoTxnMemoryChannel

java.lang.Object
  extended by org.apache.flume.channel.AbstractChannel
      extended by org.apache.flume.channel.PseudoTxnMemoryChannel
All Implemented Interfaces:
Channel, Configurable, LifecycleAware, NamedComponent

public class PseudoTxnMemoryChannel
extends AbstractChannel

A capacity-capped Channel implementation that supports in-memory buffering and delivery of events.

This channel is appropriate for best effort delivery of events where high throughput is favored over data durability. To be clear, this channel offers absolutely no guarantee of event delivery in the face of (any) component failure.

TODO: Discuss guarantees, corner cases re: potential data loss (e.g. consumer begins a tx, takes events, and gets SIGKILL before rollback).

Configuration options

Parameter Description Unit / Type Default
capacity The in-memory capacity of this channel. Store up to capacity events before refusing new events. events / int 50
keep-alive The amount of time (seconds) to wait for an event before returning null on take(). seconds / int 3

Metrics

TODO


Nested Class Summary
static class PseudoTxnMemoryChannel.NoOpTransaction
           A no-op transaction implementation that does nothing at all.
 
Constructor Summary
PseudoTxnMemoryChannel()
           
 
Method Summary
 void configure(Context context)
           Request the implementing class to (re)configure itself.
 Transaction getTransaction()
           
 void put(Event event)
          Puts the given event into the channel.
 void start()
           Starts a service or component.
 void stop()
           Stops a service or component.
 Event take()
          Returns the next event from the channel if available.
 
Methods inherited from class org.apache.flume.channel.AbstractChannel
getLifecycleState, getName, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PseudoTxnMemoryChannel

public PseudoTxnMemoryChannel()
Method Detail

configure

public void configure(Context context)
Description copied from interface: Configurable

Request the implementing class to (re)configure itself.

When configuration parameters are changed, they must be reflected by the component asap.

There are no thread safety guarrantees on when configure might be called.

Specified by:
configure in interface Configurable
Overrides:
configure in class AbstractChannel

start

public void start()
Description copied from interface: LifecycleAware

Starts a service or component.

Implementations should determine the result of any start logic and effect the return value of LifecycleAware.getLifecycleState() accordingly.

Specified by:
start in interface LifecycleAware
Overrides:
start in class AbstractChannel

stop

public void stop()
Description copied from interface: LifecycleAware

Stops a service or component.

Implementations should determine the result of any stop logic and effect the return value of LifecycleAware.getLifecycleState() accordingly.

Specified by:
stop in interface LifecycleAware
Overrides:
stop in class AbstractChannel

put

public void put(Event event)
Description copied from interface: Channel

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.
See Also:
Transaction.begin()

take

public Event take()
Description copied from interface: Channel

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.
See Also:
Transaction.begin()

getTransaction

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


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