Interface FlowRegistryClient
- All Superinterfaces:
ConfigurableComponent
- All Known Implementing Classes:
AbstractFlowRegistryClient
Represents and external source, where flows might be stored and retrieved from. The interface provides the possibility to have multiple different types of registries backing NiFi.
FlowRegistryClient
s are discovered using Java's
ServiceLoader
mechanism. As a result, all implementations must
follow these rules:
- The implementation must implement this interface.
- The implementation must have a file named
org.apache.nifi.registry.flow.FlowRegistryClient located within the jar's
META-INF/services
directory. This file contains a list of fully-qualified class names of allFlowRegistryClient
s in the jar, one-per-line. - The implementation must support a default constructor.
FlowRegistryClient
instances are always considered "active" and approachable when the validation status is considered as valid.
Therefore after initialize, implementations must expect incoming requests any time.
The argument list of the request methods contain instances FlowRegistryClientConfigurationContext
, which always contains the current
state of the properties. Caching properties between method calls is not recommended.
-
Method Summary
Modifier and TypeMethodDescriptionderegisterFlow
(FlowRegistryClientConfigurationContext context, String bucketId, String flowId) Deletes the specified flow from the Flow Registry.getBucket
(FlowRegistryClientConfigurationContext context, String bucketId) Gets the bucket with the given id.Gets the buckets for the specified user.getFlow
(FlowRegistryClientConfigurationContext context, String bucketId, String flowId) Retrieves a flow by bucket id and Flow id.getFlowContents
(FlowRegistryClientConfigurationContext context, String bucketId, String flowId, int version) Retrieves the contents of the flow snaphot with the given Bucket id, Flow id, and version, from the Registry.getFlows
(FlowRegistryClientConfigurationContext context, String bucketId) Retrieves the set of all Flows for the specified bucket.getFlowVersions
(FlowRegistryClientConfigurationContext context, String bucketId, String flowId) Retrieves the set of all versions of the specified flow.int
getLatestVersion
(FlowRegistryClientConfigurationContext context, String bucketId, String flowId) Returns the latest (most recent) version of the Flow in the Flow Registry for the given bucket and Flow.void
boolean
isStorageLocationApplicable
(FlowRegistryClientConfigurationContext context, String location) Decides if the given location is applicable by the repository instance.registerFlow
(FlowRegistryClientConfigurationContext context, RegisteredFlow flow) Registers the given RegisteredFlow into the the Flow Registry.registerFlowSnapshot
(FlowRegistryClientConfigurationContext context, RegisteredFlowSnapshot flowSnapshot) Adds the given snapshot to the Flow Registry for the given Flow.Methods inherited from interface org.apache.nifi.components.ConfigurableComponent
getIdentifier, getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate
-
Method Details
-
initialize
-
isStorageLocationApplicable
boolean isStorageLocationApplicable(FlowRegistryClientConfigurationContext context, String location) Decides if the given location is applicable by the repository instance. The format depends on the implementation.- Parameters:
context
- Configuration context.location
- The location of versioned flow to check.- Returns:
- True in case of the given storage location is applicable, false otherwise. An applicable location does not mean that the flow specified by the location is stored in the registry. Depending on the implementation it might be merely a static check on the format of the location string. In case of uncertainty, NiFi tries to load the versioned flow from registries with true return value first.
-
getBuckets
Set<FlowRegistryBucket> getBuckets(FlowRegistryClientConfigurationContext context) throws FlowRegistryException, IOException Gets the buckets for the specified user.- Parameters:
context
- Configuration context.- Returns:
- Buckets for this user. In case there are no available buckets for the user the result will be an empty set.
- Throws:
FlowRegistryException
- If an issue happens during processing the request.IOException
- If there is issue with the communication between NiFi and the Flow Registry.
-
getBucket
FlowRegistryBucket getBucket(FlowRegistryClientConfigurationContext context, String bucketId) throws FlowRegistryException, IOException Gets the bucket with the given id.- Parameters:
context
- Configuration context.bucketId
- The id of the bucket.- Returns:
- The bucket with the given id.
- Throws:
NoSuchBucketException
- If there is no bucket in the Registry with the given id.FlowRegistryException
- If an issue happens during processing the request.IOException
- If there is issue with the communication between NiFi and the Flow Registry.
-
registerFlow
RegisteredFlow registerFlow(FlowRegistryClientConfigurationContext context, RegisteredFlow flow) throws FlowRegistryException, IOException Registers the given RegisteredFlow into the the Flow Registry.- Parameters:
context
- Configuration context.flow
- The RegisteredFlow to add to the Registry.- Returns:
- The fully populated RegisteredFlow
- Throws:
FlowAlreadyExistsException
- If a Flow with the given identifier already exists in the registry.FlowRegistryException
- If an issue happens during processing the request.IOException
- If there is issue with the communication between NiFi and the Flow Registry.
-
deregisterFlow
RegisteredFlow deregisterFlow(FlowRegistryClientConfigurationContext context, String bucketId, String flowId) throws FlowRegistryException, IOException Deletes the specified flow from the Flow Registry.- Parameters:
context
- Configuration context.bucketId
- The id of the bucket.flowId
- The id of the flow.- Returns:
- The deleted Flow.
- Throws:
FlowRegistryException
- If an issue happens during processing the request.IOException
- If there is issue with the communication between NiFi and the Flow Registry.
-
getFlow
RegisteredFlow getFlow(FlowRegistryClientConfigurationContext context, String bucketId, String flowId) throws FlowRegistryException, IOException Retrieves a flow by bucket id and Flow id.- Parameters:
context
- Configuration context.bucketId
- The id of the bucket.flowId
- The id of the Flow.- Returns:
- The Flow for the given bucket and Flow id's.
- Throws:
NoSuchFlowException
- If there is no Flow in the bucket with the given id.FlowRegistryException
- If an issue happens during processing the request.IOException
- If there is issue with the communication between NiFi and the Flow Registry.
-
getFlows
Set<RegisteredFlow> getFlows(FlowRegistryClientConfigurationContext context, String bucketId) throws FlowRegistryException, IOException Retrieves the set of all Flows for the specified bucket.- Parameters:
context
- Configuration context.bucketId
- The id of the bucket.- Returns:
- The set of all Flows from the specified bucket. In case there are no available flows in the bucket the result will be an empty set.
- Throws:
FlowRegistryException
- If an issue happens during processing the request.IOException
- If there is issue with the communication between NiFi and the Flow Registry.
-
getFlowContents
RegisteredFlowSnapshot getFlowContents(FlowRegistryClientConfigurationContext context, String bucketId, String flowId, int version) throws FlowRegistryException, IOException Retrieves the contents of the flow snaphot with the given Bucket id, Flow id, and version, from the Registry.- Parameters:
context
- Configuration context.bucketId
- The id of the bucket.flowId
- The id of the Flow.version
- The version to retrieve.- Returns:
- The contents of the Flow from the Flow Registry.
- Throws:
NoSuchFlowVersionException
- If there is no version of the Flow with the given version number.FlowRegistryException
- If an issue happens during processing the request.IOException
- If there is issue with the communication between NiFi and the Flow Registry.
-
registerFlowSnapshot
RegisteredFlowSnapshot registerFlowSnapshot(FlowRegistryClientConfigurationContext context, RegisteredFlowSnapshot flowSnapshot) throws FlowRegistryException, IOException Adds the given snapshot to the Flow Registry for the given Flow.- Parameters:
context
- Configuration context.flowSnapshot
- The flow snapshot to register.- Returns:
- The flow snapshot.
- Throws:
FlowRegistryException
- If an issue happens during processing the request.IOException
- If there is issue with the communication between NiFi and the Flow Registry.
-
getFlowVersions
Set<RegisteredFlowSnapshotMetadata> getFlowVersions(FlowRegistryClientConfigurationContext context, String bucketId, String flowId) throws FlowRegistryException, IOException Retrieves the set of all versions of the specified flow.- Parameters:
context
- Configuration context.bucketId
- The id of the bucket.flowId
- The id of the flow.- Returns:
- The set of all versions of the specified flow. In case there are no available versions for the specified flow the result will be an empty set.
- Throws:
FlowRegistryException
- If an issue happens during processing the request.IOException
- If there is issue with the communication between NiFi and the Flow Registry.
-
getLatestVersion
int getLatestVersion(FlowRegistryClientConfigurationContext context, String bucketId, String flowId) throws FlowRegistryException, IOException Returns the latest (most recent) version of the Flow in the Flow Registry for the given bucket and Flow.- Parameters:
context
- Configuration context.bucketId
- The id of the bucket.flowId
- The id of the flow. The result must be a positive number and the first version expected to have the version id of 1. If by some reason the specified flow has no versions, the result will be 0, signing the lack of versions. 0 is not directly assigned to any actual version.- Returns:
- The latest version of the Flow.
- Throws:
FlowRegistryException
- If an issue happens during processing the request.IOException
- If there is issue with the communication between NiFi and the Flow Registry.
-