Java Code Examples for org.apache.nifi.web.api.dto.ConnectionDTO#setLoadBalancePartitionAttribute()
The following examples show how to use
org.apache.nifi.web.api.dto.ConnectionDTO#setLoadBalancePartitionAttribute() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NiFiClientUtil.java From nifi with Apache License 2.0 | 5 votes |
public ConnectionEntity updateConnectionLoadBalancing(final ConnectionEntity connectionEntity, final LoadBalanceStrategy strategy, final LoadBalanceCompression compression, final String loadBalanceAttribute) throws NiFiClientException, IOException { final ConnectionDTO connectionDto = new ConnectionDTO(); connectionDto.setLoadBalancePartitionAttribute(loadBalanceAttribute); connectionDto.setLoadBalanceStrategy(strategy.name()); connectionDto.setLoadBalanceCompression(compression.name()); connectionDto.setId(connectionEntity.getId()); final ConnectionEntity updatedEntity = new ConnectionEntity(); updatedEntity.setComponent(connectionDto); updatedEntity.setId(connectionEntity.getId()); updatedEntity.setRevision(connectionEntity.getRevision()); return nifiClient.getConnectionClient().updateConnection(updatedEntity); }
Example 2
Source File: FlowFromDOMFactory.java From nifi with Apache License 2.0 | 4 votes |
public static ConnectionDTO getConnection(final Element element) { final ConnectionDTO dto = new ConnectionDTO(); dto.setId(getString(element, "id")); dto.setName(getString(element, "name")); dto.setLabelIndex(getOptionalInt(element, "labelIndex")); dto.setzIndex(getOptionalLong(element, "zIndex")); dto.setVersionedComponentId(getString(element, "versionedComponentId")); final List<PositionDTO> bends = new ArrayList<>(); final Element bendPointsElement = DomUtils.getChild(element, "bendPoints"); if (bendPointsElement != null) { for (final Element bendPointElement : getChildrenByTagName(bendPointsElement, "bendPoint")) { final PositionDTO bend = getPosition(bendPointElement); bends.add(bend); } } dto.setBends(bends); final ConnectableDTO sourceConnectable = new ConnectableDTO(); dto.setSource(sourceConnectable); sourceConnectable.setId(getString(element, "sourceId")); sourceConnectable.setGroupId(getString(element, "sourceGroupId")); sourceConnectable.setType(getString(element, "sourceType")); final ConnectableDTO destConnectable = new ConnectableDTO(); dto.setDestination(destConnectable); destConnectable.setId(getString(element, "destinationId")); destConnectable.setGroupId(getString(element, "destinationGroupId")); destConnectable.setType(getString(element, "destinationType")); final Set<String> relationships = new HashSet<>(); final List<Element> relationshipNodeList = getChildrenByTagName(element, "relationship"); for (final Element relationshipElem : relationshipNodeList) { relationships.add(relationshipElem.getTextContent()); } dto.setSelectedRelationships(relationships); dto.setBackPressureObjectThreshold(getLong(element, "maxWorkQueueSize")); final String maxDataSize = getString(element, "maxWorkQueueDataSize"); if (maxDataSize != null && !maxDataSize.trim().isEmpty()) { dto.setBackPressureDataSizeThreshold(maxDataSize); } String expiration = getString(element, "flowFileExpiration"); if (expiration == null) { expiration = "0 sec"; } dto.setFlowFileExpiration(expiration); final List<String> prioritizerClasses = new ArrayList<>(); final List<Element> prioritizerNodeList = getChildrenByTagName(element, "queuePrioritizerClass"); for (final Element prioritizerElement : prioritizerNodeList) { prioritizerClasses.add(prioritizerElement.getTextContent().trim()); } dto.setPrioritizers(prioritizerClasses); dto.setLoadBalanceStrategy(getString(element, "loadBalanceStrategy")); dto.setLoadBalancePartitionAttribute(getString(element, "partitioningAttribute")); dto.setLoadBalanceCompression(getString(element, "loadBalanceCompression")); return dto; }