Class ListenTCP
java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processor.AbstractProcessor
org.apache.nifi.processors.standard.ListenTCP
- All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent,org.apache.nifi.processor.Processor
@SupportsBatching
@InputRequirement(INPUT_FORBIDDEN)
@Tags({"listen","tcp","tls","ssl"})
@CapabilityDescription("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.")
@WritesAttribute(attribute="tcp.sender",description="The sending host of the messages.") @WritesAttribute(attribute="tcp.port",description="The sending port the messages were received.") @WritesAttribute(attribute="client.certificate.issuer.dn",description="For connections using mutual TLS, the Distinguished Name of the Certificate Authority that issued the client\'s certificate is attached to the FlowFile.") @WritesAttribute(attribute="client.certificate.subject.dn",description="For connections using mutual TLS, the Distinguished Name of the client certificate\'s owner (subject) is attached to the FlowFile.")
public class ListenTCP
extends org.apache.nifi.processor.AbstractProcessor
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.apache.nifi.components.PropertyDescriptorprivate static final Stringprivate static final Stringprotected BlockingQueue<ByteArrayMessage> protected EventBatcher<ByteArrayMessage> protected TrackingLinkedBlockingQueue<ByteArrayMessage> private intprotected EventServerprotected static final org.apache.nifi.components.PropertyDescriptorprotected byte[]private final AtomicLongprotected static final org.apache.nifi.components.PropertyDescriptorprotected intprivate static final List<org.apache.nifi.components.PropertyDescriptor> static final org.apache.nifi.processor.Relationshipprivate static final Set<org.apache.nifi.processor.Relationship> static final org.apache.nifi.components.PropertyDescriptorprivate static final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddClientCertificateAttributes(Map<String, String> attributes, ByteArrayMessage event) private EventBatcher<ByteArrayMessage> intprivate StringgetMessageDemarcator(org.apache.nifi.processor.ProcessContext context) final Set<org.apache.nifi.processor.Relationship> List<org.apache.nifi.components.PropertyDescriptor> protected StringvoidvoidonScheduled(org.apache.nifi.processor.ProcessContext context) voidonTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) private voidprocessEvents(org.apache.nifi.processor.ProcessSession session, Map<String, FlowFileEventBatch<ByteArrayMessage>> batches) private voidvoidstopped()Methods inherited from class org.apache.nifi.processor.AbstractProcessor
onTriggerMethods inherited from class org.apache.nifi.processor.AbstractSessionFactoryProcessor
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrueMethods inherited from class org.apache.nifi.components.AbstractConfigurableComponent
customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.nifi.components.ConfigurableComponent
getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validateMethods inherited from interface org.apache.nifi.processor.Processor
isStateful, migrateRelationships
-
Field Details
-
CLIENT_CERTIFICATE_SUBJECT_DN_ATTRIBUTE
- See Also:
-
CLIENT_CERTIFICATE_ISSUER_DN_ATTRIBUTE
- See Also:
-
SSL_CONTEXT_SERVICE
public static final org.apache.nifi.components.PropertyDescriptor SSL_CONTEXT_SERVICE -
CLIENT_AUTH
public static final org.apache.nifi.components.PropertyDescriptor CLIENT_AUTH -
POOL_RECV_BUFFERS
protected static final org.apache.nifi.components.PropertyDescriptor POOL_RECV_BUFFERS -
IDLE_CONNECTION_TIMEOUT
protected static final org.apache.nifi.components.PropertyDescriptor IDLE_CONNECTION_TIMEOUT -
PROPERTY_DESCRIPTORS
-
REL_SUCCESS
public static final org.apache.nifi.processor.Relationship REL_SUCCESS -
RELATIONSHIPS
-
TRACKING_LOG_INTERVAL
private static final long TRACKING_LOG_INTERVAL- See Also:
-
nextTrackingLog
-
eventsCapacity
private int eventsCapacity -
port
protected volatile int port -
events
-
errorEvents
-
eventServer
-
messageDemarcatorBytes
protected volatile byte[] messageDemarcatorBytes -
eventBatcher
-
-
Constructor Details
-
ListenTCP
public ListenTCP()
-
-
Method Details
-
migrateProperties
-
onScheduled
@OnScheduled public void onScheduled(org.apache.nifi.processor.ProcessContext context) throws IOException - Throws:
IOException
-
getListeningPort
public int getListeningPort() -
onTrigger
public void onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) throws org.apache.nifi.processor.exception.ProcessException - Specified by:
onTriggerin classorg.apache.nifi.processor.AbstractProcessor- Throws:
org.apache.nifi.processor.exception.ProcessException
-
processEvents
private void processEvents(org.apache.nifi.processor.ProcessSession session, Map<String, FlowFileEventBatch<ByteArrayMessage>> batches) -
stopped
@OnStopped public void stopped() -
getAttributes
-
getTransitUri
-
getRelationships
- Specified by:
getRelationshipsin interfaceorg.apache.nifi.processor.Processor- Overrides:
getRelationshipsin classorg.apache.nifi.processor.AbstractSessionFactoryProcessor
-
getSupportedPropertyDescriptors
- Overrides:
getSupportedPropertyDescriptorsin classorg.apache.nifi.components.AbstractConfigurableComponent
-
getMessageDemarcator
-
getEventBatcher
-
addClientCertificateAttributes
-
processTrackingLog
private void processTrackingLog()
-