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, parseBatchSizeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetBatchSizeprotected Integer getMaxTries()
public void append(Event event) throws EventDeliveryException
append in interface RpcClientappend in class AbstractRpcClientevent - The event to be appended.EventDeliveryExceptionpublic void appendBatch(List<Event> events) throws EventDeliveryException
appendBatch in interface RpcClientappendBatch in class AbstractRpcClientevents - The events to be appended.EventDeliveryExceptionpublic boolean isActive()
RpcClientReturns 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 RpcClientisActive in class AbstractRpcClientpublic void close()
throws FlumeException
close in interface RpcClientclose in class AbstractRpcClientFlumeExceptionprotected InetSocketAddress getLastConnectedServerAddress()
public void configure(Properties properties) throws FlumeException
AbstractRpcClientconfigure in class AbstractRpcClientFlumeException - if the client can not be configured using this
method, or if the client was already configured once.Copyright © 2009-2022 Apache Software Foundation. All Rights Reserved.