Class SocketClient

java.lang.Object
org.apache.nifi.remote.client.AbstractSiteToSiteClient
org.apache.nifi.remote.client.socket.SocketClient
All Implemented Interfaces:
Closeable, AutoCloseable, SiteToSiteClient

public class SocketClient extends AbstractSiteToSiteClient
  • Field Details

    • logger

      private static final org.slf4j.Logger logger
    • pool

      private final EndpointConnectionPool pool
    • compress

      private final boolean compress
    • portName

      private final String portName
    • penalizationNanos

      private final long penalizationNanos
    • portIdentifier

      private volatile String portIdentifier
    • closed

      private volatile boolean closed
  • Constructor Details

  • Method Details

    • isSecure

      public boolean isSecure() throws IOException
      Description copied from interface: SiteToSiteClient

      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.

      Returns:
      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 client
      Throws:
      IOException - if unable to query the remote instance's RESTful interface or if the remote instance is not configured to allow site-to-site communications
    • getPortIdentifier

      private String getPortIdentifier(TransferDirection direction) throws IOException
      Throws:
      IOException
    • createRemoteDestination

      private RemoteDestination createRemoteDestination(String portId, String portName)
    • createTransaction

      public Transaction createTransaction(TransferDirection direction) throws IOException
      Description copied from interface: SiteToSiteClient

      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.

      Parameters:
      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.
      Returns:
      a Transaction to use for sending or receiving data, or null if all nodes are penalized.
      Throws:
      IOException - ioe
    • close

      public void close() throws IOException
      Throws:
      IOException