I am trying to write a function that takes two parameters, a processor ID in nifi instance A and an input port in nifi instance B and creates an RPG in nifi instance A which connects the above to.
Now, how I am doing that is
A POST to the /nifi-api/process-groups//remote-process-groups endpoint to create an RPG and retrieve the ID of that RPG
A POST to the /nifi-api/process-groups//connections endpoint to create a connection between the processor and the input port. the processorID and the ID of the input port are being provided along with the list of the relationships.
A final PUT to /nifi-api/remote-process-groups/ to enable the transmission between the machines.
Now, the function always throws errors in step 2. A 409 is thrown for the POST request with the error being 'Unable to find specified destination'. (though refreshing the canvas on machine 1 shows the rpg having been created) However, when I manually run the steps 2 and 3 afterwards, with the same rpgid, the connection happens.
Now, I'm not sure if this is a synchronization issue or not, but I want to figure it out because I would not want to separate out steps 1 2 and 3. Could somebody point out what could be the issue here?
PS - the post messages for steps 2 are the same when the api is called from within the function and manually.