Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Unable to check/uncheck Auto Termination Success/Failure function NiFi processor using Groovy script

avatar
New Contributor

HI,

We are using Apache NiFi for transferring the data using GetSFTP and PUTSFTP. For this we are using (RestAPI) groovy scripts for creating,updating the processors properties and making connections between them. All the properties are able to update using groovy scripts except one.

We are unable to enable (checked/true) the Auto Termination property of processors like Failure/Success.

So, is any way to change this properties using Groovy scripts ?

Thanks & Regards

Suchet

2 REPLIES 2

avatar
New Contributor

For this I am creating a curl request which looks like:

curl -i -X POST -H 'Content-Type: application/json' http://localhost:8080/nifi-api/process-groups/7932922c-0168-1000-2ef0-0149d99a9ac4/processors -d '{ "revision":{ "version":0 }, "permissions":{ "canRead":true, "canWrite":true }, "component":{ "parentGroupId":"7932922c-0168-1000-2ef0-0149d99a9ac4", "name":"d_PutSFTP", "type":"org.apache.nifi.processors.standard.GetSFTP", "config":{ "properties":{ "Hostname":"xx.xx.xx.xx", "Port":"22", "Username":"username", "Password":null, "autoTerminatedRelationships": ['success'] } } } }'

But it is giving an exception like:

Cannot deserialize instance of `java.lang.String` out of START_ARRAY token at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 19, column: 32] (through reference chain: org.apache.nifi.web.api.entity.ProcessorEntity["component"]->org.apache.nifi.web.api.dto.ProcessorDTO["config"]->org.apache.nifi.web.api.dto.ProcessorConfigDTO["properties"]->java.util.LinkedHashMap["autoTerminatedRelationships"])

Does anyone know where am I doing wrong to create request.

In nifi api document, "autoTerminatedRelationships": ["value"] is given.

avatar
Master Mentor
@Suchet Renge

There is no reason that you should not be able to auto-terminate a relationship via the rest-api. Are you seeing some error when trying to execute that specific rest-api endpoint?
-

Keep in mind that you can not Auto-terminate a relationship that is currently connected to another component. You must first either remove that relationship from any connection to which it has been assigned or delete the entire connection containing that relationship.

-

Here is a sample rest-api call to set relationship "success" to auto terminate on a logAttribute processor:

curl 'http://<nifi-hostname>:<nifi-port>/nifi-api/processors/<processor UUID>' -X PUT -H 'Content-Type: application/json' --data-binary '{"component":{"id":"<processor UUID>","name":"LogAttribute","config":{"concurrentlySchedulableTaskCount":"1","schedulingPeriod":"0 sec","executionNode":"ALL","penaltyDuration":"30 sec","yieldDuration":"1 sec","bulletinLevel":"WARN","schedulingStrategy":"TIMER_DRIVEN","comments":"","runDurationMillis":0,"autoTerminatedRelationships":["success"]},"state":"STOPPED"},"revision":{"clientId":"9ef6f9e3-0168-1000-82cb-02214bcbc612","version":10}}' --compressed 

-

Thank you,

Matt