Interface FlowFileQueue
- All Known Subinterfaces:
LoadBalancedFlowFileQueue
-
Method Summary
Modifier and TypeMethodDescriptionvoidacknowledge(Collection<FlowFileRecord> flowFiles) voidacknowledge(FlowFileRecord flowFile) cancelDropFlowFileRequest(String requestIdentifier) Cancels the request to drop FlowFiles that has the given identifier.cancelListFlowFileRequest(String requestIdentifier) Cancels the request to list FlowFiles that has the given identifier.dropFlowFiles(String requestIdentifier, String requestor) Initiates a request to drop all FlowFiles in this queue.longgetDropFlowFileStatus(String requestIdentifier) Returns the current status of a Drop FlowFile Request that was initiated via thedropFlowFiles(String, String)method that has the given identifiergetFlowFile(String flowFileUuid) Returns the FlowFile with the given UUID ornullif no FlowFile can be found in this queue with the given UUIDorg.apache.nifi.controller.status.FlowFileAvailabilitylonggetFlowFileExpiration(TimeUnit timeUnit) getListFlowFileStatus(String requestIdentifier) Returns the current status of a List FlowFile Request that was initiated via thelistFlowFiles(String, int)method that has the given identifierlongReturns diagnostic information about the queuelonggetTotalQueuedDuration(long fromTimestamp) booleanbooleanbooleanisEmpty()booleanisFull()booleanlistFlowFiles(String requestIdentifier, int maxResults) Initiates a request to obtain a listing of FlowFiles in this queue.voidlock()voidOffloads the flowfiles in the queue to other nodes.poll(int maxResults, Set<FlowFileRecord> expiredRecords) poll(int maxResults, Set<FlowFileRecord> expiredRecords, PollStrategy pollStrategy) poll(Set<FlowFileRecord> expiredRecords) poll(Set<FlowFileRecord> expiredRecords, PollStrategy pollStrategy) poll(org.apache.nifi.processor.FlowFileFilter filter, Set<FlowFileRecord> expiredRecords) poll(org.apache.nifi.processor.FlowFileFilter filter, Set<FlowFileRecord> expiredRecords, PollStrategy pollStrategy) voidDestroys any Swap Files that exist for this queue without updating the FlowFile Repository or Provenance Repository.voidput(FlowFileRecord file) places the given file into the queuevoidputAll(Collection<FlowFileRecord> files) places the given files into the queueReads any Swap Files that belong to this queue and returns a summary of what is swapped out.voidResets a queue that has previously been offloaded.voidsetBackPressureDataSizeThreshold(String maxDataSize) voidsetBackPressureObjectThreshold(long maxQueueSize) Establishes this queue's preferred maximum work load.voidsetFlowFileExpiration(String flowExpirationPeriod) voidsetLoadBalanceCompression(LoadBalanceCompression compression) voidsetLoadBalanceStrategy(LoadBalanceStrategy strategy, String partitioningAttribute) voidsetPriorities(List<FlowFilePrioritizer> newPriorities) Resets the comparator used by this queue to maintain order.org.apache.nifi.controller.queue.QueueSizesize()voidvoidvoidunlock()voidEnsures that a listing can be performed on the queue
-
Method Details
-
getIdentifier
String getIdentifier()- Returns:
- the unique identifier for this FlowFileQueue
-
getPriorities
List<FlowFilePrioritizer> getPriorities()- Returns:
- list of processing priorities for this queue
-
recoverSwappedFlowFiles
SwapSummary recoverSwappedFlowFiles()Reads any Swap Files that belong to this queue and returns a summary of what is swapped out. This will be called only during NiFi startup as an initialization step. This method is then responsible for returning a FlowFileSummary of the FlowFiles that are swapped out, ornullif no FlowFiles are swapped out for this queue.- Returns:
- a SwapSummary that describes the FlowFiles that exist in the queue but are swapped out.
-
purgeSwapFiles
void purgeSwapFiles()Destroys any Swap Files that exist for this queue without updating the FlowFile Repository or Provenance Repository. This is done only on startup in the case of non-persistent repositories. In the case of non-persistent repositories, we may still have Swap Files because we may still need to overflow the FlowFiles from heap onto disk, even though we don't want to keep the FlowFiles on restart. -
setPriorities
Resets the comparator used by this queue to maintain order.- Parameters:
newPriorities- the ordered list of prioritizers to use to determine order within this queue.- Throws:
NullPointerException- if arg is null
-
setBackPressureObjectThreshold
void setBackPressureObjectThreshold(long maxQueueSize) Establishes this queue's preferred maximum work load.- Parameters:
maxQueueSize- the maximum number of flow files this processor recommends having in its work queue at any one time
-
getBackPressureObjectThreshold
long getBackPressureObjectThreshold()- Returns:
- maximum number of flow files that should be queued up at any one time
-
setBackPressureDataSizeThreshold
- Parameters:
maxDataSize- Establishes this queue's preferred maximum data size.
-
getBackPressureDataSizeThreshold
String getBackPressureDataSizeThreshold()- Returns:
- maximum data size that should be queued up at any one time
-
size
org.apache.nifi.controller.queue.QueueSize size() -
getTotalQueuedDuration
long getTotalQueuedDuration(long fromTimestamp) - Parameters:
fromTimestamp- The timestamp in milliseconds from which to calculate durations. This will typically be the current timestamp.- Returns:
- the sum in milliseconds of how long all FlowFiles within this queue have currently been in this queue.
-
getMinLastQueueDate
long getMinLastQueueDate()- Returns:
- The minimum lastQueueDate in milliseconds of all FlowFiles currently enqueued. If no FlowFile is enqueued, this returns 0.
-
isEmpty
boolean isEmpty()- Returns:
- true if no items queue; false otherwise
-
getFlowFileAvailability
org.apache.nifi.controller.status.FlowFileAvailability getFlowFileAvailability()- Returns:
- the FlowFile Availability for this queue
-
isActiveQueueEmpty
boolean isActiveQueueEmpty()- Returns:
trueif the queue is empty or contains only FlowFiles that already are being processed by others,falseif the queue contains at least one FlowFile that is available for processing, regardless of whether that FlowFile(s) is in-memory or swapped out.
-
acknowledge
-
acknowledge
-
isUnacknowledgedFlowFile
boolean isUnacknowledgedFlowFile()- Returns:
trueif at least one FlowFile is unacknowledged,falseif all FlowFiles that have been dequeued have been acknowledged
-
isFull
boolean isFull()- Returns:
- true if maximum queue size has been reached or exceeded; false otherwise
-
put
places the given file into the queue- Parameters:
file- to place into queue
-
putAll
places the given files into the queue- Parameters:
files- to place into queue
-
poll
- Parameters:
expiredRecords- expired recordspollStrategy- strategy of polling- Returns:
- the next flow file on the queue; null if empty
-
poll
-
poll
List<FlowFileRecord> poll(int maxResults, Set<FlowFileRecord> expiredRecords, PollStrategy pollStrategy) - Parameters:
maxResults- limits how many results can be polledexpiredRecords- for expired recordspollStrategy- strategy of polling- Returns:
- the next flow files on the queue up to the max results; null if empty
-
poll
-
poll
List<FlowFileRecord> poll(org.apache.nifi.processor.FlowFileFilter filter, Set<FlowFileRecord> expiredRecords, PollStrategy pollStrategy) -
poll
List<FlowFileRecord> poll(org.apache.nifi.processor.FlowFileFilter filter, Set<FlowFileRecord> expiredRecords) -
getFlowFileExpiration
String getFlowFileExpiration() -
getFlowFileExpiration
-
setFlowFileExpiration
-
dropFlowFiles
Initiates a request to drop all FlowFiles in this queue. This method returns a DropFlowFileStatus that can be used to determine the current state of the request. Additionally, the DropFlowFileStatus provides a request identifier that can then be passed to thegetDropFlowFileStatus(String)andcancelDropFlowFileRequest(String)methods in order to obtain the status later or cancel a request- Parameters:
requestIdentifier- the identifier of the Drop FlowFile Requestrequestor- the entity that is requesting that the FlowFiles be dropped; this will be included in the Provenance Events that are generated.- Returns:
- the status of the drop request.
-
getDropFlowFileStatus
Returns the current status of a Drop FlowFile Request that was initiated via thedropFlowFiles(String, String)method that has the given identifier- Parameters:
requestIdentifier- the identifier of the Drop FlowFile Request- Returns:
- the status for the request with the given identifier, or
nullif no request status exists with that identifier
-
cancelDropFlowFileRequest
Cancels the request to drop FlowFiles that has the given identifier. After this method is called, the request will no longer be known by this queue, so subsequent calls togetDropFlowFileStatus(String)orcancelDropFlowFileRequest(String)will returnnull- Parameters:
requestIdentifier- the identifier of the Drop FlowFile Request- Returns:
- the status for the request with the given identifier after it has been canceled, or
nullif no request status exists with that identifier
-
listFlowFiles
Initiates a request to obtain a listing of FlowFiles in this queue. This method returns a ListFlowFileStatus that can be used to obtain information about the FlowFiles that exist within the queue. Additionally, the ListFlowFileStatus provides a request identifier that can then be passed to the
getListFlowFileStatus(String). The listing of FlowFiles will be returned ordered by the position of the FlowFile in the queue.Note that if maxResults is larger than the size of the "active queue" (i.e., the un-swapped queued, FlowFiles that are swapped out will not be returned.)
- Parameters:
requestIdentifier- the identifier of the List FlowFile RequestmaxResults- the maximum number of FlowFileSummary objects to add to the ListFlowFileStatus- Returns:
- the status for the request
- Throws:
IllegalStateException- if either the source or the destination of the connection to which this queue belongs is currently running.
-
getListFlowFileStatus
Returns the current status of a List FlowFile Request that was initiated via thelistFlowFiles(String, int)method that has the given identifier- Parameters:
requestIdentifier- the identifier of the Drop FlowFile Request- Returns:
- the current status of the List FlowFile Request with the given identifier or
nullif no request status exists with that identifier
-
cancelListFlowFileRequest
Cancels the request to list FlowFiles that has the given identifier. After this method is called, the request will no longer be known by this queue, so subsequent calls togetListFlowFileStatus(String)orcancelListFlowFileRequest(String)will returnnull- Parameters:
requestIdentifier- the identifier of the Drop FlowFile Request- Returns:
- the current status of the List FlowFile Request with the given identifier or
nullif no request status exists with that identifier
-
getFlowFile
Returns the FlowFile with the given UUID ornullif no FlowFile can be found in this queue with the given UUID- Parameters:
flowFileUuid- the UUID of the FlowFile to retrieve- Returns:
- the FlowFile with the given UUID or
nullif no FlowFile can be found in this queue with the given UUID - Throws:
IOException- if unable to read FlowFiles that are stored on some external device
-
verifyCanList
Ensures that a listing can be performed on the queue- Throws:
IllegalStateException- if the queue is not in a state in which a listing can be performed
-
getQueueDiagnostics
QueueDiagnostics getQueueDiagnostics()Returns diagnostic information about the queue -
lock
void lock() -
unlock
void unlock() -
setLoadBalanceStrategy
-
offloadQueue
void offloadQueue()Offloads the flowfiles in the queue to other nodes. This disables the queue from partition flowfiles locally.This operation is a no-op if the node that contains this queue is not in a cluster.
-
resetOffloadedQueue
void resetOffloadedQueue()Resets a queue that has previously been offloaded. This allows the queue to partition flowfiles locally, and has no other effect on processors or remote process groups.This operation is a no-op if the queue is not currently offloaded or the node that contains this queue is not clustered.
-
getLoadBalanceStrategy
LoadBalanceStrategy getLoadBalanceStrategy() -
setLoadBalanceCompression
-
getLoadBalanceCompression
LoadBalanceCompression getLoadBalanceCompression() -
getPartitioningAttribute
String getPartitioningAttribute() -
startLoadBalancing
void startLoadBalancing() -
stopLoadBalancing
void stopLoadBalancing() -
isActivelyLoadBalancing
boolean isActivelyLoadBalancing()- Returns:
trueif the queue is actively transferring data to another node,falseotherwise
-