Search in sources :

Example 1 with ListFlowFileStatus

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;
}
Also used : ListFlowFileStatus(org.apache.nifi.controller.queue.ListFlowFileStatus) Connection(org.apache.nifi.connectable.Connection) FlowFileQueue(org.apache.nifi.controller.queue.FlowFileQueue) ResourceNotFoundException(org.apache.nifi.web.ResourceNotFoundException)

Example 2 with ListFlowFileStatus

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;
}
Also used : ListFlowFileStatus(org.apache.nifi.controller.queue.ListFlowFileStatus) Connection(org.apache.nifi.connectable.Connection) FlowFileQueue(org.apache.nifi.controller.queue.FlowFileQueue) ResourceNotFoundException(org.apache.nifi.web.ResourceNotFoundException)

Example 3 with 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());
}
Also used : ListFlowFileStatus(org.apache.nifi.controller.queue.ListFlowFileStatus) Test(org.junit.Test)

Example 4 with ListFlowFileStatus

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());
}
Also used : ListFlowFileStatus(org.apache.nifi.controller.queue.ListFlowFileStatus) ArrayList(java.util.ArrayList) FlowFileRecord(org.apache.nifi.controller.repository.FlowFileRecord) Test(org.junit.Test)

Example 5 with ListFlowFileStatus

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());
}
Also used : ListFlowFileStatus(org.apache.nifi.controller.queue.ListFlowFileStatus) Test(org.junit.Test)

Aggregations

ListFlowFileStatus (org.apache.nifi.controller.queue.ListFlowFileStatus)5 Test (org.junit.Test)3 Connection (org.apache.nifi.connectable.Connection)2 FlowFileQueue (org.apache.nifi.controller.queue.FlowFileQueue)2 ResourceNotFoundException (org.apache.nifi.web.ResourceNotFoundException)2 ArrayList (java.util.ArrayList)1 FlowFileRecord (org.apache.nifi.controller.repository.FlowFileRecord)1