public static boolean flowFilesQueued(final Connectable connectable) { for (final Connection conn : connectable.getIncomingConnections()) { if (!conn.getFlowFileQueue().isActiveQueueEmpty()) { return true; } } return false; }
public static boolean anyRelationshipAvailable(final Connectable connectable) { for (final Relationship relationship : connectable.getRelationships()) { final Collection<Connection> connections = connectable.getConnections(relationship); boolean available = true; for (final Connection connection : connections) { if (connection.getFlowFileQueue().isFull()) { available = false; break; } } if (available) { return true; } } return false; }
private void addConnection(final Element parentElement, final Connection connection) { final Document doc = parentElement.getOwnerDocument(); final Element element = doc.createElement("connection"); parentElement.appendChild(element); addTextElement(element, "id", connection.getIdentifier()); addTextElement(element, "name", connection.getName()); final Element bendPointsElement = doc.createElement("bendPoints"); element.appendChild(bendPointsElement); for (final Position bendPoint : connection.getBendPoints()) { addPosition(bendPointsElement, bendPoint, "bendPoint"); } addTextElement(element, "labelIndex", connection.getLabelIndex()); addTextElement(element, "zIndex", connection.getZIndex()); final String sourceId = connection.getSource().getIdentifier(); final ConnectableType sourceType = connection.getSource().getConnectableType(); final String sourceGroupId; if (sourceType == ConnectableType.REMOTE_OUTPUT_PORT) { sourceGroupId = ((RemoteGroupPort) connection.getSource()).getRemoteProcessGroup().getIdentifier(); } else { sourceGroupId = connection.getSource().getProcessGroup().getIdentifier(); } final ConnectableType destinationType = connection.getDestination().getConnectableType(); final String destinationId = connection.getDestination().getIdentifier(); final String destinationGroupId; if (destinationType == ConnectableType.REMOTE_INPUT_PORT) { destinationGroupId = ((RemoteGroupPort) connection.getDestination()).getRemoteProcessGroup().getIdentifier(); } else { destinationGroupId = connection.getDestination().getProcessGroup().getIdentifier(); } addTextElement(element, "sourceId", sourceId); addTextElement(element, "sourceGroupId", sourceGroupId); addTextElement(element, "sourceType", sourceType.toString()); addTextElement(element, "destinationId", destinationId); addTextElement(element, "destinationGroupId", destinationGroupId); addTextElement(element, "destinationType", destinationType.toString()); for (final Relationship relationship : connection.getRelationships()) { addTextElement(element, "relationship", relationship.getName()); } addTextElement( element, "maxWorkQueueSize", connection.getFlowFileQueue().getBackPressureObjectThreshold()); addTextElement( element, "maxWorkQueueDataSize", connection.getFlowFileQueue().getBackPressureDataSizeThreshold()); addTextElement( element, "flowFileExpiration", connection.getFlowFileQueue().getFlowFileExpiration()); for (final FlowFilePrioritizer comparator : connection.getFlowFileQueue().getPriorities()) { final String className = comparator.getClass().getCanonicalName(); addTextElement(element, "queuePrioritizerClass", className); } parentElement.appendChild(element); }