ListenTCP
Description
Listens for incoming TCP connections and reads data from each connection using a line separator as the message demarcator. The default behavior is for each message to produce a single FlowFile, however this can be controlled by increasing the Batch Size to a larger value for higher throughput. The Receive Buffer Size must be set as large as the largest messages expected to be received, meaning if every 100kb there is a line separator, then the Receive Buffer Size must be greater than 100kb. The processor can be configured to use an SSL Context Service to only allow secure connections. When connected clients present certificates for mutual TLS authentication, the Distinguished Names of the client certificate's issuer and subject are added to the outgoing FlowFiles as attributes. The processor does not perform authorization based on Distinguished Name values, but since these values are attached to the outgoing FlowFiles, authorization can be implemented based on these attributes.
Tags
listen, ssl, tcp, tls
Properties
In the list below required Properties are shown with an asterisk (*). Other properties are considered optional. The table also indicates any default values, and whether a property supports the NiFi Expression Language.
Display Name | API Name | Default Value | Allowable Values | Description |
---|---|---|---|---|
Local Network Interface | Local Network Interface | The name of a local network interface to be used to restrict listening to a specific LAN. Supports Expression Language, using Environment variables. | ||
Port * | Port | The port to listen on for communication. Supports Expression Language, using Environment variables. | ||
Receive Buffer Size * | Receive Buffer Size | 65507 B | The size of each buffer used to receive messages. Adjust this value appropriately based on the expected size of the incoming messages. | |
Max Size of Message Queue * | Max Size of Message Queue | 10000 | The maximum size of the internal queue used to buffer messages being transferred from the underlying channel to the processor. Setting this value higher allows more messages to be buffered in memory during surges of incoming messages, but increases the total memory used by the processor during these surges. | |
Max Size of Socket Buffer * | Max Size of Socket Buffer | 1 MB | The maximum size of the socket buffer that should be used. This is a suggestion to the Operating System to indicate how big the socket buffer should be. If this value is set too low, the buffer may fill up before the data can be read, and incoming data will be dropped. | |
Character Set * | Character Set | UTF-8 | Specifies the character set of the received data. | |
Max Number of Worker Threads * | Max Number of TCP Connections | 2 | The maximum number of worker threads available for servicing TCP connections. | |
Max Batch Size * | Max Batch Size | 1 | The maximum number of messages to add to a single FlowFile. If multiple messages are available, they will be concatenated along with the <Message Delimiter> up to this configured maximum number of messages | |
Batching Message Delimiter * | Message Delimiter | \n | Specifies the delimiter to place between messages when multiple messages are bundled together (see <Max Batch Size> property). | |
Idle Connection Timeout * | idle-timeout | 0 seconds | The amount of time a client's connection will remain open if no data is received. The default of 0 seconds will leave connections open until they are closed by the client. | |
Pool Receive Buffers * | pool-receive-buffers | True |
| Enable or disable pooling of buffers that the processor uses for handling bytes received on socket connections. The framework allocates buffers as needed during processing. |
SSL Context Service | SSL Context Service | Controller Service: RestrictedSSLContextService Implementations: StandardRestrictedSSLContextService | The Controller Service to use in order to obtain an SSL Context. If this property is set, messages will be received over a secure connection. | |
Client Auth | Client Auth | REQUIRED |
| The client authentication policy to use for the SSL Context. Only used if an SSL Context Service is provided. |
Dynamic Properties
This component does not support dynamic properties.
Relationships
Name | Description |
---|---|
success | Messages received successfully will be sent out this relationship. |
Reads Attributes
This processor does not read attributes.
Writes Attributes
Name | Description |
---|---|
client.certificate.issuer.dn | For connections using mutual TLS, the Distinguished Name of the Certificate Authority that issued the client's certificate is attached to the FlowFile. |
client.certificate.subject.dn | For connections using mutual TLS, the Distinguished Name of the client certificate's owner (subject) is attached to the FlowFile. |
tcp.port | The sending port the messages were received. |
tcp.sender | The sending host of the messages. |
State Management
This component does not store state.
Restricted
This component is not restricted.
Input Requirement
This component does not allow an incoming relationship.
System Resource Considerations
This component does not specify system resource considerations.