org.apache.flume.api
Interface RpcClient

All Known Implementing Classes:
AbstractRpcClient, FailoverRpcClient, LoadBalancingRpcClient, NettyAvroRpcClient

public interface RpcClient

Public client interface for sending data to Flume.

This interface is intended not to change incompatibly for Flume 1.x.

Note: It is recommended for applications to construct RpcClient instances using the RpcClientFactory class, instead of using builders associated with a particular implementation class.

See Also:
RpcClientFactory

Method Summary
 void append(Event event)
          Send a single Event to the associated Flume source.
 void appendBatch(List<Event> events)
          Send a list of events to the associated Flume source.
 void close()
          Immediately closes the client so that it may no longer be used.
 int getBatchSize()
          Returns the maximum number of events that may be batched at once by appendBatch().
 boolean isActive()
          Returns true if this object appears to be in a usable state, and it returns false if this object is permanently disabled.
 

Method Detail

getBatchSize

int getBatchSize()
Returns the maximum number of events that may be batched at once by appendBatch().


append

void append(Event event)
            throws EventDeliveryException

Send a single Event to the associated Flume source.

This method blocks until the RPC returns or until the request times out.

Note: If this method throws an EventDeliveryException, there is no way to recover and the application must invoke close() on this object to clean up system resources.

Parameters:
event -
Throws:
EventDeliveryException - when an error prevents event delivery.

appendBatch

void appendBatch(List<Event> events)
                 throws EventDeliveryException

Send a list of events to the associated Flume source.

This method blocks until the RPC returns or until the request times out.

It is strongly recommended that the number of events in the List be no more than getBatchSize(). If it is more, multiple RPC calls will be required, and the likelihood of duplicate Events being stored will increase.

Note: If this method throws an EventDeliveryException, there is no way to recover and the application must invoke close() on this object to clean up system resources.

Parameters:
events - List of events to send
Throws:
EventDeliveryException - when an error prevents event delivery.

isActive

boolean isActive()

Returns true if this object appears to be in a usable state, and it returns false if this object is permanently disabled.

If this method returns false, an application must call close() on this object to clean up system resources.


close

void close()
           throws FlumeException

Immediately closes the client so that it may no longer be used.

Note: This method MUST be called by applications when they are done using the RPC client in order to clean up resources.

Multi-threaded applications may want to gracefully stop making RPC calls before calling close(). Otherwise, they risk getting EventDeliveryException thrown from their in-flight calls when the underlying connection is disabled.

Throws:
FlumeException


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