Class FetchFileTransfer
java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processor.AbstractProcessor
org.apache.nifi.processor.util.file.transfer.FetchFileTransfer
- All Implemented Interfaces:
ConfigurableComponent,Processor
A base class for FetchSFTP, FetchFTP processors.
Note that implementations of this class should never use the @SupportsBatching annotation! Doing so
could result in data loss!
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classWrapper around a FileTransfer object that is used to know when the FileTransfer was last used, so that we have the ability to close connections that are "idle," or unused for some period of time. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AllowableValuestatic final AllowableValuestatic final AllowableValuestatic final PropertyDescriptorstatic final Stringstatic final PropertyDescriptorprivate final Map<Tuple<String, Integer>, BlockingQueue<FetchFileTransfer.FileTransferIdleWrapper>> static final PropertyDescriptorprivate final longprivate longprivate LogLevelstatic final PropertyDescriptorstatic final PropertyDescriptorstatic final Relationshipstatic final Relationshipstatic final Relationshipstatic final Relationshipstatic final PropertyDescriptorstatic final PropertyDescriptorstatic final PropertyDescriptor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()private voidcleanupTransfer(FileTransfer transfer, boolean closeConnection, BlockingQueue<FetchFileTransfer.FileTransferIdleWrapper> transferQueue, String host, int port) private voidcloseConnections(boolean closeNonIdleConnections) Close connections that are idle or optionally close all connections.protected abstract FileTransfercreateFileTransfer(ProcessContext context) Creates a new instance of a FileTransfer that can be used to pull files from a remote system.protected List<PropertyDescriptor> voidonScheduled(ProcessContext context) voidonTrigger(ProcessContext context, ProcessSession session) private voidperformCompletionStrategy(FileTransfer transfer, ProcessContext context, FlowFile flowFile, String filename, String host, int port) 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, migrateProperties, migrateRelationships
-
Field Details
-
COMPLETION_NONE
-
COMPLETION_MOVE
-
COMPLETION_DELETE
-
FAILURE_REASON_ATTRIBUTE
- See Also:
-
HOSTNAME
-
UNDEFAULTED_PORT
-
USERNAME
-
REMOTE_FILENAME
-
COMPLETION_STRATEGY
-
MOVE_CREATE_DIRECTORY
-
MOVE_DESTINATION_DIR
-
FILE_NOT_FOUND_LOG_LEVEL
-
REL_SUCCESS
-
REL_COMMS_FAILURE
-
REL_NOT_FOUND
-
REL_PERMISSION_DENIED
-
fileTransferMap
private final Map<Tuple<String,Integer>, fileTransferMapBlockingQueue<FetchFileTransfer.FileTransferIdleWrapper>> -
IDLE_CONNECTION_MILLIS
private final long IDLE_CONNECTION_MILLIS -
lastClearTime
private volatile long lastClearTime -
levelFileNotFound
-
-
Constructor Details
-
FetchFileTransfer
public FetchFileTransfer()
-
-
Method Details
-
getRelationships
- Specified by:
getRelationshipsin interfaceProcessor- Overrides:
getRelationshipsin classAbstractSessionFactoryProcessor
-
onScheduled
-
closeConnections
private void closeConnections(boolean closeNonIdleConnections) Close connections that are idle or optionally close all connections. Connections are considered "idle" if they have not been used in 10 seconds.- Parameters:
closeNonIdleConnections- iftruewill close all connection; iffalsewill close only idle connections
-
cleanup
-
getSupportedPropertyDescriptors
- Overrides:
getSupportedPropertyDescriptorsin classAbstractConfigurableComponent
-
onTrigger
- Specified by:
onTriggerin classAbstractProcessor- Throws:
ProcessException
-
cleanupTransfer
private void cleanupTransfer(FileTransfer transfer, boolean closeConnection, BlockingQueue<FetchFileTransfer.FileTransferIdleWrapper> transferQueue, String host, int port) -
performCompletionStrategy
private void performCompletionStrategy(FileTransfer transfer, ProcessContext context, FlowFile flowFile, String filename, String host, int port) -
createFileTransfer
Creates a new instance of a FileTransfer that can be used to pull files from a remote system.- Parameters:
context- the ProcessContext to use in order to obtain configured properties- Returns:
- a FileTransfer that can be used to pull files from a remote system
-