I'm not familiar with Spring RestTemplate but I'm sure they offer the ability to get at the response body. Maybe it's possible to implement a custom error handler or something.
Without knowing more, I could venture a guess that your requests are failing intermittently because you not passing along the correct revision. NiFi employs an optimistic locking model whereby clients pass along a revision version to indicate that currently hold the most update to date version of that component. Here a blog that details this and provides a nice sequence diagram to help visualize it [1]. The relevant details are towards the bottom. Matt [1] https://community.hortonworks.com/content/kbentry/3160/update-nifi-flow-on-the-fly-via-api.html On Tue, Dec 6, 2016 at 1:53 PM, Nirmal Kumar <[email protected]> wrote: > Thanks but as I calling it programmatically using Spring RestTemplate I > just get the stack trace as mentioned in my below mail. > > > > -Nirmal > > > > *From:* Matt Gilman [mailto:[email protected]] > *Sent:* Tuesday, December 6, 2016 6:58 PM > *To:* [email protected] > *Subject:* Re: Getting > org.springframework.web.client.HttpClientErrorException: > 409 Conflict on DELETE ProcessGroup > > > > Nirmal, > > > > If you consume the body of the response it should indicate the reason for > the 409. On failed responses, the response body should be text/plain. Let > me know if that helps. > > > > Thanks > > > > Matt > > > > > > On Mon, Dec 5, 2016 at 11:29 PM, Nirmal Kumar <[email protected]> > wrote: > > Hi All, > > > > I am getting the following exception **intermittently** when firing a > DELETE request for deleting the Process group: > > http://xxx.xxx.xxx.xxx:9091/nifi-api/process-groups/ > 103111c4-123b-14f9-a794-14795038dbdf?version=0 > > > > org.springframework.web.client.HttpClientErrorException: 409 Conflict > > at org.springframework.web.client.DefaultResponseErrorHandler. > handleError(DefaultResponseErrorHandler.java:91) ~[nifi-util-1.0.0.jar:na] > > at org.springframework.web.client.RestTemplate. > handleResponseError(RestTemplate.java:615) ~[nifi-util-1.0.0.jar:na] > > at > org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:573) > ~[nifi-util-1.0.0.jar:na] > > at > org.springframework.web.client.RestTemplate.execute(RestTemplate.java:529) > ~[nifi-util-1.0.0.jar:na] > > at > org.springframework.web.client.RestTemplate.delete(RestTemplate.java:401) > ~[nifi-util-1.0.0.jar:na] > > > > I am using Nifi 1.0.0 version. > > > > Not sure if setting these timeout will help here: > > *public* RestTemplate restTemplate() { > > *return* *new* RestTemplate(*clientHttpRequestFactory*()); > > } > > > > *private* *ClientHttpRequestFactory* clientHttpRequestFactory() { > > *HttpComponentsClientHttpRequestFactory* factory = *new* > *HttpComponentsClientHttpRequestFactory*(); > > factory.setReadTimeout(2000); > > factory.setConnectTimeout(2000); > > *return* factory; > > } > > > > Any pointers here would be great. > > > > Thanks, > > -Nirmal > > > > > ------------------------------ > > > > > > > > NOTE: This message may contain information that is confidential, > proprietary, privileged or otherwise protected by law. The message is > intended solely for the named addressee. If received in error, please > destroy and notify the sender. Any use of this email is prohibited when > received in error. Impetus does not represent, warrant and/or guarantee, > that the integrity of this communication has been maintained nor that the > communication is free of errors, virus, interception or interference. > > > > ------------------------------ > > > > > > > NOTE: This message may contain information that is confidential, > proprietary, privileged or otherwise protected by law. The message is > intended solely for the named addressee. If received in error, please > destroy and notify the sender. Any use of this email is prohibited when > received in error. Impetus does not represent, warrant and/or guarantee, > that the integrity of this communication has been maintained nor that the > communication is free of errors, virus, interception or interference. >
