use of org.apache.nifi.controller.queue.DropFlowFileStatus in project nifi by apache.
the class StandardConnectionDAO method deleteFlowFileDropRequest.
@Override
public DropFlowFileStatus deleteFlowFileDropRequest(String connectionId, String dropRequestId) {
final Connection connection = locateConnection(connectionId);
final FlowFileQueue queue = connection.getFlowFileQueue();
final DropFlowFileStatus dropFlowFileStatus = queue.cancelDropFlowFileRequest(dropRequestId);
if (dropFlowFileStatus == null) {
throw new ResourceNotFoundException(String.format("Unable to find drop request with id '%s'.", dropRequestId));
}
return dropFlowFileStatus;
}
use of org.apache.nifi.controller.queue.DropFlowFileStatus in project nifi by apache.
the class StandardConnectionDAO method getFlowFileDropRequest.
@Override
public DropFlowFileStatus getFlowFileDropRequest(String connectionId, String dropRequestId) {
final Connection connection = locateConnection(connectionId);
final FlowFileQueue queue = connection.getFlowFileQueue();
final DropFlowFileStatus dropRequest = queue.getDropFlowFileStatus(dropRequestId);
if (dropRequest == null) {
throw new ResourceNotFoundException(String.format("Unable to find drop request with id '%s'.", dropRequestId));
}
return dropRequest;
}
use of org.apache.nifi.controller.queue.DropFlowFileStatus in project nifi by apache.
the class TestStandardFlowFileQueue method testBackPressureAfterDrop.
@Test(timeout = 10000)
public void testBackPressureAfterDrop() throws InterruptedException {
queue.setBackPressureObjectThreshold(10);
queue.setFlowFileExpiration("10 millis");
for (int i = 0; i < 9; i++) {
queue.put(new TestFlowFile());
assertFalse(queue.isFull());
}
queue.put(new TestFlowFile());
assertTrue(queue.isFull());
Thread.sleep(100L);
final String requestId = UUID.randomUUID().toString();
final DropFlowFileStatus status = queue.dropFlowFiles(requestId, "Unit Test");
while (status.getState() != DropFlowFileState.COMPLETE) {
Thread.sleep(10L);
}
assertFalse(queue.isFull());
assertTrue(queue.isEmpty());
assertTrue(queue.isActiveQueueEmpty());
assertEquals(10, provRecords.size());
for (final ProvenanceEventRecord event : provRecords) {
assertNotNull(event);
assertEquals(ProvenanceEventType.DROP, event.getEventType());
}
}
use of org.apache.nifi.controller.queue.DropFlowFileStatus in project nifi by apache.
the class TestStandardFlowFileQueue method testDropSwappedFlowFiles.
@Test(timeout = 120000)
public void testDropSwappedFlowFiles() {
for (int i = 1; i <= 30000; i++) {
queue.put(new TestFlowFile());
}
assertEquals(2, swapManager.swappedOut.size());
final DropFlowFileStatus status = queue.dropFlowFiles("1", "Unit Test");
while (status.getState() != DropFlowFileState.COMPLETE) {
try {
Thread.sleep(100L);
} catch (final Exception e) {
}
}
assertEquals(0, queue.size().getObjectCount());
assertEquals(0, queue.size().getByteCount());
assertEquals(0, swapManager.swappedOut.size());
assertEquals(2, swapManager.swapInCalledCount);
}
Aggregations