Re: Getting org.springframework.web.client.HttpClientErrorException: 409 Conflict on DELETE ProcessGroup

2016-12-07 Thread Matt Gilman
Ok. It could be caused if the ProcessGroup is not in a deletable state (if
for instance there is data queued up in an encapsulated connection). Again,
the response body should indicate the underlying issue.

I looked at the RestTemplate stuff and it appears you can specify a custom
ResponseErrorHandler [1] that provides you access to the underlying
response. The default implementation simply throws an exception as shown in
your previous stack traces.

Hope this helps.

Matt

[1]
http://docs.spring.io/spring/docs/3.2.x/javadoc-api/org/springframework/web/client/ResponseErrorHandler.html

On Wed, Dec 7, 2016 at 2:51 AM, Nirmal Kumar <nirmal.ku...@impetus.co.in>
wrote:

> Each time I fire the DELETE request I first GET the ProcessGroup details
> and then fetch the *version*.
>
> So I am passing the correct version in DELETE request.
>
>
>
> Thanks,
>
> -Nirmal
>
>
>
> *From:* Matt Gilman [mailto:matt.c.gil...@gmail.com]
> *Sent:* Wednesday, December 7, 2016 12:37 AM
>
> *To:* users@nifi.apache.org
> *Subject:* Re: Getting 
> org.springframework.web.client.HttpClientErrorException:
> 409 Conflict on DELETE ProcessGroup
>
>
>
> 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 <nirmal.ku...@impetus.co.in>
> 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:matt.c.gil...@gmail.com]
> *Sent:* Tuesday, December 6, 2016 6:58 PM
> *To:* users@nifi.apache.org
> *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 <nirmal.ku...@impetus.co.in>
> 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 informatio

Re: Getting org.springframework.web.client.HttpClientErrorException: 409 Conflict on DELETE ProcessGroup

2016-12-06 Thread Matt Gilman
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 <nirmal.ku...@impetus.co.in>
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:matt.c.gil...@gmail.com]
> *Sent:* Tuesday, December 6, 2016 6:58 PM
> *To:* users@nifi.apache.org
> *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 <nirmal.ku...@impetus.co.in>
> 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.
>


RE: Getting org.springframework.web.client.HttpClientErrorException: 409 Conflict on DELETE ProcessGroup

2016-12-06 Thread Nirmal Kumar
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:matt.c.gil...@gmail.com]
Sent: Tuesday, December 6, 2016 6:58 PM
To: users@nifi.apache.org
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 
<nirmal.ku...@impetus.co.in<mailto:nirmal.ku...@impetus.co.in>> 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.


Re: Getting org.springframework.web.client.HttpClientErrorException: 409 Conflict on DELETE ProcessGroup

2016-12-06 Thread Matt Gilman
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 
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.
>


Getting org.springframework.web.client.HttpClientErrorException: 409 Conflict on DELETE ProcessGroup

2016-12-05 Thread Nirmal Kumar
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.