public static class SiteToSiteClient.Builder extends Object implements Serializable
The Builder is the mechanism by which all configuration is passed to the
SiteToSiteClient. Once constructed, the SiteToSiteClient cannot be
reconfigured (i.e., it is immutable). If a change in configuration should
be desired, the client should be closed and a
new client created.
| Modifier and Type | Field and Description |
|---|---|
private int |
batchCount |
private long |
batchNanos |
private long |
batchSize |
private long |
contentsCacheExpirationMillis |
private EventReporter |
eventReporter |
private HttpProxy |
httpProxy |
private long |
idleExpirationNanos |
private String |
keystoreFilename |
private String |
keystorePass |
private KeystoreType |
keystoreType |
private InetAddress |
localAddress |
private File |
peerPersistenceFile |
private long |
penalizationNanos |
private String |
portIdentifier |
private String |
portName |
private static long |
serialVersionUID |
private SSLContext |
sslContext |
private StateManager |
stateManager |
private long |
timeoutNanos |
private SiteToSiteTransportProtocol |
transportProtocol |
private String |
truststoreFilename |
private String |
truststorePass |
private KeystoreType |
truststoreType |
private Set<String> |
urls |
private boolean |
useCompression |
| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
SiteToSiteClient |
build() |
SiteToSiteClientConfig |
buildConfig() |
SiteToSiteClient.Builder |
cacheExpiration(long expirationPeriod,
TimeUnit unit)
Specifies how long the contents of a remote NiFi instance should be cached before making
another web request to the remote instance.
|
SiteToSiteClient.Builder |
eventReporter(EventReporter eventReporter)
Provides an EventReporter that can be used by the client in order to
report any events that could be of interest when communicating with
the remote instance.
|
SiteToSiteClient.Builder |
fromConfig(SiteToSiteClientConfig config)
Populates the builder with values from the provided config
|
EventReporter |
getEventReporter() |
HttpProxy |
getHttpProxy() |
long |
getIdleConnectionExpiration(TimeUnit timeUnit) |
String |
getKeystoreFilename() |
String |
getKeystorePass() |
KeystoreType |
getKeystoreType() |
File |
getPeerPersistenceFile() |
long |
getPenalizationPeriod(TimeUnit timeUnit) |
String |
getPortIdentifier() |
String |
getPortName() |
SSLContext |
getSslContext() |
long |
getTimeout(TimeUnit timeUnit) |
SiteToSiteTransportProtocol |
getTransportProtocol() |
String |
getTruststoreFilename() |
String |
getTruststorePass() |
KeystoreType |
getTruststoreType() |
String |
getUrl() |
SiteToSiteClient.Builder |
httpProxy(HttpProxy httpProxy)
Specify a HTTP proxy information to use with HTTP protocol of Site-to-Site communication.
|
SiteToSiteClient.Builder |
idleExpiration(long timeout,
TimeUnit unit)
Specifies the amount of time that a connection can remain idle in the
connection pool before it is "expired" and shutdown.
|
boolean |
isUseCompression() |
SiteToSiteClient.Builder |
keystoreFilename(String keystoreFilename)
Sets the filename to use for the Keystore in order to communicate securely
with the remote instance of NiFi
|
SiteToSiteClient.Builder |
keystorePass(String keystorePass)
Sets the password to use for the Keystore in order to communicate securely
with the remote instance of NiFi
|
SiteToSiteClient.Builder |
keystoreType(KeystoreType keystoreType)
Sets the type of the Keystore to use in order to communicate securely
with the remote instance of NiFi
|
SiteToSiteClient.Builder |
localAddress(InetAddress localAddress)
Specifies the local address to use when communicating with the remote NiFi instance.
|
SiteToSiteClient.Builder |
nodePenalizationPeriod(long period,
TimeUnit unit)
If there is a problem communicating with a node (i.e., any node in
the remote NiFi cluster or the remote instance of NiFi if it is
standalone), specifies how long the client should wait before
attempting to communicate with that node again.
|
SiteToSiteClient.Builder |
peerPersistenceFile(File peerPersistenceFile)
Specifies a file that the client can write to in order to persist the
list of nodes in the remote cluster and recover the list of nodes
upon restart.
|
SiteToSiteClient.Builder |
portIdentifier(String portIdentifier)
Specifies the unique identifier of the port to communicate with.
|
SiteToSiteClient.Builder |
portName(String portName)
Specifies the name of the port to communicate with.
|
SiteToSiteClient.Builder |
requestBatchCount(int count)
When pulling data from a NiFi instance, the sender chooses how large
a Transaction is.
|
SiteToSiteClient.Builder |
requestBatchDuration(long value,
TimeUnit unit)
When pulling data from a NiFi instance, the sender chooses how large
a Transaction is.
|
SiteToSiteClient.Builder |
requestBatchSize(long bytes)
When pulling data from a NiFi instance, the sender chooses how large
a Transaction is.
|
SiteToSiteClient.Builder |
sslContext(SSLContext sslContext)
Specifies the SSL Context to use when communicating with the remote
NiFi instance(s).
|
SiteToSiteClient.Builder |
stateManager(StateManager stateManager)
Specifies StateManager that the client can persist the
list of nodes in the remote cluster and recover the list of nodes
upon restart.
|
SiteToSiteClient.Builder |
timeout(long timeout,
TimeUnit unit)
Specifies the communications timeouts to use when interacting with
the remote instances.
|
SiteToSiteClient.Builder |
transportProtocol(SiteToSiteTransportProtocol transportProtocol)
Specifies the protocol to use for site to site data transport.
|
SiteToSiteClient.Builder |
truststoreFilename(String truststoreFilename)
Sets the filename to use for the Truststore in order to communicate securely
with the remote instance of NiFi
|
SiteToSiteClient.Builder |
truststorePass(String truststorePass)
Sets the password to use for the Truststore in order to communicate securely
with the remote instance of NiFi
|
SiteToSiteClient.Builder |
truststoreType(KeystoreType truststoreType)
Sets the password type of the Truststore to use in order to communicate securely
with the remote instance of NiFi
|
SiteToSiteClient.Builder |
url(String url)
Specifies the URL of the remote NiFi instance.
|
SiteToSiteClient.Builder |
urls(Set<String> urls)
Specifies the URLs of the remote NiFi instance.
|
SiteToSiteClient.Builder |
useCompression(boolean compress)
Specifies whether or not data should be compressed before being
transferred to or from the remote instance.
|
private static final long serialVersionUID
private long timeoutNanos
private long penalizationNanos
private long idleExpirationNanos
private long contentsCacheExpirationMillis
private SSLContext sslContext
private String keystoreFilename
private String keystorePass
private KeystoreType keystoreType
private String truststoreFilename
private String truststorePass
private KeystoreType truststoreType
private EventReporter eventReporter
private File peerPersistenceFile
private StateManager stateManager
private boolean useCompression
private String portName
private String portIdentifier
private int batchCount
private long batchSize
private long batchNanos
private InetAddress localAddress
private SiteToSiteTransportProtocol transportProtocol
private HttpProxy httpProxy
public SiteToSiteClient.Builder fromConfig(SiteToSiteClientConfig config)
config - to start withpublic SiteToSiteClient.Builder url(String url)
Specifies the URL of the remote NiFi instance.
If this URL points to a NiFi node in a NiFi cluster, data transfer to and from nodes will be automatically load balanced across the different nodes.
For better connectivity with a NiFi cluster, use urls(Set) instead.
url - url of remote instancepublic SiteToSiteClient.Builder localAddress(InetAddress localAddress)
Specifies the local address to use when communicating with the remote NiFi instance.
localAddress - the local address to use, or null to use anyLocal address.public SiteToSiteClient.Builder urls(Set<String> urls)
Specifies the URLs of the remote NiFi instance.
If this URL points to a NiFi node in a NiFi cluster, data transfer to and from nodes will be automatically load balanced across the different nodes.
Multiple urls provide better connectivity with a NiFi cluster, able to connect to the target cluster at long as one of the specified urls is accessible.
urls - urls of remote instancepublic SiteToSiteClient.Builder timeout(long timeout, TimeUnit unit)
timeout - to use when interacting with remote instancesunit - unit of time over which to interpret the given timeoutpublic SiteToSiteClient.Builder cacheExpiration(long expirationPeriod, TimeUnit unit)
expirationPeriod - the amount of time that an entry in the cache should expireunit - unit of time over which to interpret the given expirationPeriodpublic SiteToSiteClient.Builder idleExpiration(long timeout, TimeUnit unit)
timeout - to use when interacting with remote instancesunit - unit of time over which to interpret the given timeoutpublic SiteToSiteClient.Builder nodePenalizationPeriod(long period, TimeUnit unit)
period - time to wait between communication attemptsunit - over which to evaluate the given periodpublic SiteToSiteClient.Builder sslContext(SSLContext sslContext)
keystoreFilename(String), keystorePass(String),
keystoreType, truststoreFilename, truststorePass(String),
and truststoreType(KeystoreType) methods must be used instead.sslContext - the contextpublic String getKeystoreFilename()
public SiteToSiteClient.Builder keystoreFilename(String keystoreFilename)
keystoreFilename - the filename to use for the Keystore in order to communicate securely
with the remote instance of NiFipublic String getKeystorePass()
public SiteToSiteClient.Builder keystorePass(String keystorePass)
keystorePass - the password to use for the Keystore in order to communicate securely
with the remote instance of NiFipublic KeystoreType getKeystoreType()
public SiteToSiteClient.Builder keystoreType(KeystoreType keystoreType)
keystoreType - the type of the Keystore to use in order to communicate securely
with the remote instance of NiFipublic String getTruststoreFilename()
public SiteToSiteClient.Builder truststoreFilename(String truststoreFilename)
truststoreFilename - the filename to use for the Truststore in order to communicate securely
with the remote instance of NiFipublic String getTruststorePass()
public SiteToSiteClient.Builder truststorePass(String truststorePass)
truststorePass - the filename to use for the Truststore in order to communicate securely
with the remote instance of NiFipublic KeystoreType getTruststoreType()
public SiteToSiteClient.Builder truststoreType(KeystoreType truststoreType)
truststoreType - the type of the Truststore to use in order to communicate securely
with the remote instance of NiFipublic SiteToSiteClient.Builder eventReporter(EventReporter eventReporter)
eventReporter - reporterpublic SiteToSiteClient.Builder peerPersistenceFile(File peerPersistenceFile)
peerPersistenceFile - filepublic SiteToSiteClient.Builder stateManager(StateManager stateManager)
Specifies StateManager that the client can persist the list of nodes in the remote cluster and recover the list of nodes upon restart. This allows the client to function if the remote nodes specified by the urls are unavailable, even after a restart of the client software. If not specified, the list of nodes will not be persisted and a failure of the Cluster Manager will result in not being able to communicate with the remote instance if a new client is created.
Using a StateManager is preferable over using a File to persist the list of nodes if the SiteToSiteClient is used by a NiFi component having access to a NiFi context. So that the list of nodes can be persisted in the same manner with other stateful information.
Since StateManager is not serializable, the specified StateManager
will not be serialized, and a de-serialized SiteToSiteClientConfig
instance will not have StateManager even if the original config has one.
Use peerPersistenceFile(File) instead
if the same SiteToSiteClientConfig needs to be distributed among multiple
clients via serialization, and also persistent connectivity is required
in case of having no available remote node specified by the urls when a client restarts.
stateManager - state managerpublic SiteToSiteClient.Builder useCompression(boolean compress)
compress - true if should compresspublic SiteToSiteClient.Builder transportProtocol(SiteToSiteTransportProtocol transportProtocol)
transportProtocol - transport protocolpublic SiteToSiteClient.Builder portName(String portName)
portName - name of portpublic SiteToSiteClient.Builder portIdentifier(String portIdentifier)
portIdentifier - identifier of portpublic SiteToSiteClient.Builder requestBatchCount(int count)
DataPackets to include in a Transaction.count - client preferred batch sizepublic SiteToSiteClient.Builder requestBatchSize(long bytes)
bytes - client preferred batch sizepublic SiteToSiteClient.Builder requestBatchDuration(long value, TimeUnit unit)
value - client preferred batch durationunit - client preferred batch duration unitpublic SiteToSiteClientConfig buildConfig()
SiteToSiteClientConfig for the configured values
but does not create a SiteToSiteClientpublic SiteToSiteClient build()
IllegalStateException - if either the url is not set or neither
the port name nor port identifier is set,
or if the transport protocol is not supported.public String getUrl()
public long getTimeout(TimeUnit timeUnit)
timeUnit - unit over which to interpret the timeoutpublic long getIdleConnectionExpiration(TimeUnit timeUnit)
timeUnit - unit over which to interpret the timepublic long getPenalizationPeriod(TimeUnit timeUnit)
timeUnit - unit of reported timepublic SSLContext getSslContext()
public EventReporter getEventReporter()
public File getPeerPersistenceFile()
public boolean isUseCompression()
public SiteToSiteTransportProtocol getTransportProtocol()
public String getPortName()
public String getPortIdentifier()
public SiteToSiteClient.Builder httpProxy(HttpProxy httpProxy)
httpProxy - HTTP proxy informationpublic HttpProxy getHttpProxy()
Copyright © 2023 Apache NiFi Project. All rights reserved.