NA Slacker
NA Slacker

Reputation: 942

Apache NiFi Create Process Group with my own ID

Background

According to the NiFi API documentation, id is an optional field on a create process group request:

POST /process-groups/{id}/process-groups
{
  "revision": {
    "version" : 0
  },
  "id" : "8a698dd8-7947-43fd-8bdd-2d4f26ee3329",
  "component": {
    "name": "my-process-group-foo"
  }
}

This will create a new process group as a child of the {id} process group. I would assume that by passing in a GUID as part of the request body, the resulting process group would be created using the GUID that I passed in.

Through testing though I've come to realize that the process group that is created is assigned an id by NiFi and does not use the id that I've passed in.

Response from above example (condensed)

{
  "revision": {
    "version": 1,
  },
  "id": "7d47183d-0173-1000-ffff-fffff6dceb50",
  "component": {
    "id": "7d47183d-0173-1000-ffff-fffff6dceb50",
    "parentGroupId": "348a629f-0173-1000-a243-b2203c5b8272",
    "name": "my-process-group-foo"
  }
}

Instead of creating my process group with the id I asked for it assigned a completely new id.

If I try add my id inside of the component object I get a 400 error Process group ID cannot be specified.

Question

Is there a way to create a process group using an id that I specify?

I am currently trying to figure out how to update versioned processes from NiFi Registry when I have the same process running on multiple clusters (different data centers). My original thought was if I could create the process group with the same id on all of the clusters, I could then have my CI/CD pipeline create a version update request, confident that the same id is on all the clusters.

References

https://nifi.apache.org/docs/nifi-docs/rest-api/index.html

Upvotes: 1

Views: 1039

Answers (1)

Chaffelson
Chaffelson

Reputation: 1269

The short answer is no you cannot specify the UUID, it will always be assigned by NiFi. I believe the field is marked as optional because you can supply it without generating an error, but it will be ignored - Such as as when you upload templates or other flow definitions.

Upvotes: 2

Related Questions