public interface SiteToSiteClient extends Closeable
The SiteToSiteClient provides a mechanism for sending data to a remote instance of NiFi (or NiFi cluster) and retrieving data from a remote instance of NiFi (or NiFi cluster).
When configuring the client via the SiteToSiteClient.Builder, the
Builder must be provided the URL of the remote NiFi instance. If the URL
points to a standalone instance of NiFi, all interaction will take place with
that instance of NiFi. However, if the URL points to the NiFi Cluster Manager
of a cluster, the client will automatically handle load balancing the
transactions across the different nodes in the cluster.
The SiteToSiteClient provides a Transaction through which all
interaction with the remote instance takes place. After data has been
exchanged or it is determined that no data is available, the Transaction can
then be canceled (via the Transaction.cancel(String) method) or can
be completed (via the Transaction.complete() method).
An instance of SiteToSiteClient can be obtained by constructing a new
instance of the SiteToSiteClient.Builder class, calling the
appropriate methods to configured the client as desired, and then calling the
build() method.
The SiteToSiteClient itself is immutable once constructed and is thread-safe.
Many threads can share access to the same client. However, the
Transaction that is created by the client is not thread safe and
should not be shared among threads.
| Modifier and Type | Interface and Description |
|---|---|
static class |
SiteToSiteClient.Builder
The Builder is the mechanism by which all configuration is passed to the
SiteToSiteClient.
|
static class |
SiteToSiteClient.StandardSiteToSiteClientConfig |
| Modifier and Type | Method and Description |
|---|---|
Transaction |
createTransaction(TransferDirection direction)
Creates a new Transaction that can be used to either send data to a
remote NiFi instance or receive data from a remote NiFi instance,
depending on the value passed for the
direction argument. |
SiteToSiteClientConfig |
getConfig() |
boolean |
isSecure()
In order to determine whether the server is configured for secure
communications, the client may have to query the server's RESTful
interface.
|
Transaction createTransaction(TransferDirection direction) throws HandshakeException, PortNotRunningException, ProtocolException, UnknownPortException, IOException
Creates a new Transaction that can be used to either send data to a
remote NiFi instance or receive data from a remote NiFi instance,
depending on the value passed for the direction argument.
Note: If all of the nodes are penalized (See
SiteToSiteClient.Builder.nodePenalizationPeriod(long, TimeUnit)), then this method
will return null.
direction - specifies which direction the data should be
transferred. A value of TransferDirection.SEND indicates that
this Transaction will send data to the remote instance; a value of
TransferDirection.RECEIVE indicates that this Transaction will be
used to receive data from the remote instance.null if all nodes are penalized.HandshakeException - hePortNotRunningException - pnreIOException - ioeUnknownPortException - upeProtocolExceptionboolean isSecure()
throws IOException
In order to determine whether the server is configured for secure communications, the client may have to query the server's RESTful interface. Doing so could result in an IOException.
true if site-to-site communications with the remote
instance are secure, false if site-to-site communications with
the remote instance are not secure. Whether or not communications are
secure depends on the server, not the clientIOException - if unable to query the remote instance's RESTful
interface or if the remote instance is not configured to allow
site-to-site communicationsSiteToSiteClientConfig getConfig()
Copyright © 2023 Apache NiFi Project. All rights reserved.