use of org.apache.nifi.controller.queue.ListFlowFileStatus in project nifi by apache.
the class StandardConnectionDAO method getFlowFileListingRequest.
@Override
public ListFlowFileStatus getFlowFileListingRequest(String connectionId, String listingRequestId) {
final Connection connection = locateConnection(connectionId);
final FlowFileQueue queue = connection.getFlowFileQueue();
final ListFlowFileStatus listRequest = queue.getListFlowFileStatus(listingRequestId);
if (listRequest == null) {
throw new ResourceNotFoundException(String.format("Unable to find listing request with id '%s'.", listingRequestId));
}
return listRequest;
}
use of org.apache.nifi.controller.queue.ListFlowFileStatus in project nifi by apache.
the class StandardConnectionDAO method deleteFlowFileListingRequest.
@Override
public ListFlowFileStatus deleteFlowFileListingRequest(String connectionId, String listingRequestId) {
final Connection connection = locateConnection(connectionId);
final FlowFileQueue queue = connection.getFlowFileQueue();
final ListFlowFileStatus listFlowFileStatus = queue.cancelListFlowFileRequest(listingRequestId);
if (listFlowFileStatus == null) {
throw new ResourceNotFoundException(String.format("Unable to find listing request with id '%s'.", listingRequestId));
}
return listFlowFileStatus;
}
use of org.apache.nifi.controller.queue.ListFlowFileStatus in project nifi by apache.
the class TestStandardFlowFileQueue method testListFlowFilesResultsLimited.
@Test(timeout = 5000)
public void testListFlowFilesResultsLimited() throws InterruptedException {
for (int i = 0; i < 30050; i++) {
queue.put(new TestFlowFile());
}
final ListFlowFileStatus status = queue.listFlowFiles(UUID.randomUUID().toString(), 100);
assertNotNull(status);
assertEquals(30050, status.getQueueSize().getObjectCount());
while (status.getState() != ListFlowFileState.COMPLETE) {
Thread.sleep(100);
}
assertEquals(100, status.getFlowFileSummaries().size());
assertEquals(100, status.getCompletionPercentage());
assertNull(status.getFailureReason());
}
use of org.apache.nifi.controller.queue.ListFlowFileStatus in project nifi by apache.
the class TestStandardFlowFileQueue method testListFlowFilesResultsLimitedCollection.
@Test(timeout = 5000)
public void testListFlowFilesResultsLimitedCollection() throws InterruptedException {
Collection<FlowFileRecord> tff = new ArrayList<>();
// Swap Size is 10000 records, so 30000 is equal to 3 swap files.
for (int i = 0; i < 30000; i++) {
tff.add(new TestFlowFile());
}
queue.putAll(tff);
final ListFlowFileStatus status = queue.listFlowFiles(UUID.randomUUID().toString(), 100);
assertNotNull(status);
assertEquals(30000, status.getQueueSize().getObjectCount());
while (status.getState() != ListFlowFileState.COMPLETE) {
Thread.sleep(100);
}
assertEquals(100, status.getFlowFileSummaries().size());
assertEquals(100, status.getCompletionPercentage());
assertNull(status.getFailureReason());
}
use of org.apache.nifi.controller.queue.ListFlowFileStatus in project nifi by apache.
the class TestStandardFlowFileQueue method testListFlowFilesOnlyActiveQueue.
@Test(timeout = 5000)
public void testListFlowFilesOnlyActiveQueue() throws InterruptedException {
for (int i = 0; i < 9999; i++) {
queue.put(new TestFlowFile());
}
final ListFlowFileStatus status = queue.listFlowFiles(UUID.randomUUID().toString(), 10000);
assertNotNull(status);
assertEquals(9999, status.getQueueSize().getObjectCount());
while (status.getState() != ListFlowFileState.COMPLETE) {
Thread.sleep(100);
}
assertEquals(9999, status.getFlowFileSummaries().size());
assertEquals(100, status.getCompletionPercentage());
assertNull(status.getFailureReason());
}
Aggregations