org.apache.flume.api
Class RpcClientFactory

java.lang.Object
  extended by org.apache.flume.api.RpcClientFactory

public class RpcClientFactory
extends Object

Factory class to construct Flume RPCClient implementations.


Nested Class Summary
static class RpcClientFactory.ClientType
           
 
Constructor Summary
RpcClientFactory()
           
 
Method Summary
static RpcClient getDefaultInstance(String hostname, Integer port)
          Returns an instance of RpcClient connected to the specified hostname and port.
static RpcClient getDefaultInstance(String hostname, Integer port, Integer batchSize)
          Returns an instance of RpcClient connected to the specified hostname and port with the specified batchSize.
static RpcClient getInstance(File propertiesFile)
          Delegates to getInstance(Properties props), given a File path to a Properties file.
static RpcClient getInstance(Properties properties)
          Returns an instance of RpcClient, optionally with failover.
static RpcClient getInstance(String hostname, Integer port)
          Deprecated.  
static RpcClient getInstance(String hostname, Integer port, Integer batchSize)
          Deprecated.  
static RpcClient getThriftInstance(Properties props)
          Return an RpcClient that uses Thrift for communicating with the next hop.
static RpcClient getThriftInstance(String hostname, Integer port)
          Return an RpcClient that uses Thrift for communicating with the next hop.
static RpcClient getThriftInstance(String hostname, Integer port, Integer batchSize)
          Return an RpcClient that uses Thrift for communicating with the next hop.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RpcClientFactory

public RpcClientFactory()
Method Detail

getInstance

public static RpcClient getInstance(Properties properties)
                             throws FlumeException
Returns an instance of RpcClient, optionally with failover. To create a failover client, the properties object should have a property client.type which has the value "failover". The client connects to hosts specified by hosts property in given properties.

Parameters:
properties - The properties to instantiate the client with.
Throws:
FlumeException
See Also:

If no client.type is specified, a default client that connects to single host at a given port is created.(type can also simply be DEFAULT for the default client)., org.apache.flume.api.NettyAvroClient


getInstance

public static RpcClient getInstance(File propertiesFile)
                             throws FileNotFoundException,
                                    IOException
Delegates to getInstance(Properties props), given a File path to a Properties file.

Parameters:
propertiesFile - Valid properties file
Returns:
RpcClient configured according to the given Properties file.
Throws:
FileNotFoundException - If the file cannot be found
IOException - If there is an IO error

getInstance

@Deprecated
public static RpcClient getInstance(String hostname,
                                               Integer port)
                             throws FlumeException
Deprecated. 

Deprecated. Use getDefaultInstance(String, Integer) instead.

Throws:
FlumeException

getDefaultInstance

public static RpcClient getDefaultInstance(String hostname,
                                           Integer port)
                                    throws FlumeException
Returns an instance of RpcClient connected to the specified hostname and port.

Throws:
FlumeException

getInstance

@Deprecated
public static RpcClient getInstance(String hostname,
                                               Integer port,
                                               Integer batchSize)
                             throws FlumeException
Deprecated. 

Deprecated. Use getDefaultInstance(String, Integer, Integer) instead.

Throws:
FlumeException

getDefaultInstance

public static RpcClient getDefaultInstance(String hostname,
                                           Integer port,
                                           Integer batchSize)
                                    throws FlumeException
Returns an instance of RpcClient connected to the specified hostname and port with the specified batchSize.

Throws:
FlumeException

getThriftInstance

public static RpcClient getThriftInstance(String hostname,
                                          Integer port,
                                          Integer batchSize)
Return an RpcClient that uses Thrift for communicating with the next hop. The next hop must have a ThriftSource listening on the specified port.

Parameters:
hostname - - The hostname of the next hop.
port - - The port on which the ThriftSource is listening
batchSize - - batch size of each transaction.
Returns:
an RpcClient which uses thrift configured with the given parameters.

getThriftInstance

public static RpcClient getThriftInstance(String hostname,
                                          Integer port)
Return an RpcClient that uses Thrift for communicating with the next hop. The next hop must have a ThriftSource listening on the specified port. This will use the default batch size. See RpcClientConfigurationConstants

Parameters:
hostname - - The hostname of the next hop.
port - - The port on which the ThriftSource is listening
Returns:
- An RpcClient which uses thrift configured with the given parameters.

getThriftInstance

public static RpcClient getThriftInstance(Properties props)
Return an RpcClient that uses Thrift for communicating with the next hop.

Parameters:
props -
Returns:
- An RpcClient which uses thrift configured with the given parameters.


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