public class NettyAvroRpcClient extends SSLContextAwareAbstractRpcClient
RpcClient
.
The connections are intended to be opened before clients are given access so
that the object cannot ever be in an inconsistent when exposed to users.enableSsl, excludeCipherSuites, excludeProtocols, includeCipherSuites, includeProtocols, trustAllCerts, truststore, truststorePassword, truststoreType
batchSize, connectTimeout, requestTimeout
Modifier | Constructor and Description |
---|---|
protected |
NettyAvroRpcClient()
This constructor is intended to be called from
RpcClientFactory . |
Modifier and Type | Method and Description |
---|---|
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.
|
void |
configure(Properties properties)
Configure the actual client using the properties.
|
boolean |
isActive()
Returns
true if this object appears to be in a usable state, and
it returns false if this object is permanently disabled. |
String |
toString() |
configureSSL
getBatchSize, parseBatchSize
protected NettyAvroRpcClient()
RpcClientFactory
.
A call to this constructor should be followed by call to configure().public void close() throws FlumeException
RpcClient
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.
close
in interface RpcClient
close
in class AbstractRpcClient
FlumeException
public void append(Event event) throws EventDeliveryException
RpcClient
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 RpcClient.close()
on this object to clean up system
resources.
append
in interface RpcClient
append
in class AbstractRpcClient
EventDeliveryException
- when an error prevents event delivery.public void appendBatch(List<Event> events) throws EventDeliveryException
RpcClient
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 RpcClient.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 RpcClient.close()
on this object to clean up system
resources.
appendBatch
in interface RpcClient
appendBatch
in class AbstractRpcClient
events
- List of events to sendEventDeliveryException
- when an error prevents event delivery.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 configure(Properties properties) throws FlumeException
Configure the actual client using the properties. properties should have at least 2 params:
hosts = alias_for_host
alias_for_host = hostname:port.
Only the first host is added, rest are discarded.Optionally it can also have a
batch-size = batchSize
configure
in class AbstractRpcClient
properties
- The properties to instantiate the client with.FlumeException
- if the client can not be configured using this
method, or if the client was already configured once.Copyright © 2009–2019 Apache Software Foundation. All rights reserved.