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.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionderegisterFlow
(FlowRegistryClientConfigurationContext context, FlowLocation flowLocation) Deletes the specified flow from the Flow Registry.default String
generateFlowId
(String flowName) Generates the id for registering a flow.default Set
<FlowRegistryBranch> Get the available branches.getBucket
(FlowRegistryClientConfigurationContext context, BucketLocation bucketLocation) Gets the bucket with the given id.getBuckets
(FlowRegistryClientConfigurationContext context, String branch) Gets the buckets for the specified user.default FlowRegistryBranch
Gets the default branch.getFlow
(FlowRegistryClientConfigurationContext context, FlowLocation flowLocation) Retrieves a flow by bucket id and Flow id.getFlowContents
(FlowRegistryClientConfigurationContext context, FlowVersionLocation flowVersionLocation) Retrieves the contents of the flow snapshot with the given Bucket id, Flow id, and version, from the Registry.getFlows
(FlowRegistryClientConfigurationContext context, BucketLocation bucketLocation) Retrieves the set of all Flows for the specified bucket.getFlowVersions
(FlowRegistryClientConfigurationContext context, FlowLocation flowLocation) Retrieves the set of all versions of the specified flow.getLatestVersion
(FlowRegistryClientConfigurationContext context, FlowLocation flowLocation) Returns the latest (most recent) version of the Flow in the Flow Registry for the given bucket and Flow.void
default boolean
Indicates if the registry supports branching.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 Flow Registry.registerFlowSnapshot
(FlowRegistryClientConfigurationContext context, RegisteredFlowSnapshot flowSnapshot, RegisterAction action) 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
-
Field Details
-
DEFAULT_BRANCH_NAME
- See Also:
-
-
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.
-
isBranchingSupported
Indicates if the registry supports branching. If the registry does not supporting branching, then this method should return false and the registry client should use the default implementations of getBranches and getDefaultBranch. If the registry does support branching, then this method should return true and the registry client should use override getBranches and getDefaultBranch to provide appropriate implementations.- Parameters:
context
- Configuration context- Returns:
- true if the registry supports branching, false otherwise
-
getBranches
default Set<FlowRegistryBranch> getBranches(FlowRegistryClientConfigurationContext context) throws FlowRegistryException, IOException Get the available branches. Should return at least one branch that matches the response of getDefaultBranch.- Parameters:
context
- Configuration context- Returns:
- the set of available branches
- Throws:
FlowRegistryException
- If an issue happens during processing the request.IOException
- If there is issue with the communication between NiFi and the Flow Registry.
-
getDefaultBranch
default FlowRegistryBranch getDefaultBranch(FlowRegistryClientConfigurationContext context) throws FlowRegistryException, IOException Gets the default branch. Must return a non-null FlowRegistryBranch instance with a non-null name. The interface provides a default implementation which will return a branch named 'main'.- Parameters:
context
- Configuration context- Returns:
- the default branch
- Throws:
FlowRegistryException
- If an issue happens during processing the request.IOException
- If there is issue with the communication between NiFi and the Flow Registry.
-
getBuckets
Set<FlowRegistryBucket> getBuckets(FlowRegistryClientConfigurationContext context, String branch) throws FlowRegistryException, IOException Gets the buckets for the specified user.- Parameters:
context
- Configuration context.branch
- the branch- 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, BucketLocation bucketLocation) throws FlowRegistryException, IOException Gets the bucket with the given id.- Parameters:
context
- Configuration context.bucketLocation
- The location 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 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, FlowLocation flowLocation) throws FlowRegistryException, IOException Deletes the specified flow from the Flow Registry.- Parameters:
context
- Configuration context.flowLocation
- the location 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, FlowLocation flowLocation) throws FlowRegistryException, IOException Retrieves a flow by bucket id and Flow id.- Parameters:
context
- Configuration context.flowLocation
- the location 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, BucketLocation bucketLocation) throws FlowRegistryException, IOException Retrieves the set of all Flows for the specified bucket.- Parameters:
context
- Configuration context.bucketLocation
- the location 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, FlowVersionLocation flowVersionLocation) throws FlowRegistryException, IOException Retrieves the contents of the flow snapshot with the given Bucket id, Flow id, and version, from the Registry.- Parameters:
context
- Configuration context.flowVersionLocation
- the location of the flow version- 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, RegisterAction action) 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.action
- The register action- 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, FlowLocation flowLocation) throws FlowRegistryException, IOException Retrieves the set of all versions of the specified flow.- Parameters:
context
- Configuration context.flowLocation
- the location 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
Optional<String> getLatestVersion(FlowRegistryClientConfigurationContext context, FlowLocation flowLocation) 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.flowLocation
- the location of the flow- Returns:
- an Optional containing the latest version of the flow, or empty if no versions exist for 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.
-
generateFlowId
Generates the id for registering a flow.- Parameters:
flowName
- the name of the flow- Returns:
- the generated id
-