public class FailoverRpcClient extends AbstractRpcClient implements RpcClient
RpcClient
which supports failover. This
takes a list of hostname port combinations and connects to the next available
(looping back to the first) host, from a given list of agents in the order
provided.
The properties used to build a FailoverRpcClient must have:
hosts = alias_for_host1 alias_for_host2
...hosts.alias_for_host1 = hostname1:port1.
hosts.alias_for_host2 = hostname2:port2.
etcOptionally it can also have a
batch-size = batchSize max-attempts = maxAttempts Given a failure, this client will attempt to append to maxAttempts clients in the hosts list immediately following the failed host (looping back to the beginning of the hosts list.
batchSize, connectTimeout, requestTimeout
Modifier | Constructor and Description |
---|---|
protected |
FailoverRpcClient() |
Modifier and Type | Method and Description |
---|---|
void |
append(Event event)
Tries to append an event to the currently connected client.
|
void |
appendBatch(List<Event> events)
Tries to append a list of events to the currently connected client.
|
void |
close()
Close the connection.
|
void |
configure(Properties properties)
Configure the client using the given properties object.
|
protected InetSocketAddress |
getLastConnectedServerAddress()
Get the last socket address this client connected to.
|
protected Integer |
getMaxTries()
Get the maximum number of "failed" hosts the client will try to establish
connection to before throwing an exception.
|
boolean |
isActive()
Returns
true if this object appears to be in a usable state, and
it returns false if this object is permanently disabled. |
getBatchSize
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBatchSize
protected Integer getMaxTries()
public void append(Event event) throws EventDeliveryException
append
in interface RpcClient
append
in class AbstractRpcClient
event
- The event to be appended.EventDeliveryException
public void appendBatch(List<Event> events) throws EventDeliveryException
appendBatch
in interface RpcClient
appendBatch
in class AbstractRpcClient
events
- The events to be appended.EventDeliveryException
public boolean isActive()
RpcClient
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
RpcClient.close()
on this object to clean up system resources.
isActive
in interface RpcClient
isActive
in class AbstractRpcClient
public void close() throws FlumeException
close
in interface RpcClient
close
in class AbstractRpcClient
FlumeException
protected InetSocketAddress getLastConnectedServerAddress()
public void configure(Properties properties) throws FlumeException
AbstractRpcClient
configure
in class AbstractRpcClient
FlumeException
- if the client can not be configured using this
method, or if the client was already configured once.Copyright © 2009-2016 Apache Software Foundation. All Rights Reserved.