You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by Matt Gilman <ma...@gmail.com> on 2016/01/19 17:58:01 UTC

Re: control nifi processors with REST (ie without GUI)

Philippe,

NiFi employs an optimistic locking scheme that requires clients to pass in
a revision when making a mutable request. The revision is comprised of a
version (a number that increments with each modification) and a client id.
The client id can be any string. Typically however, you'll use the client
id that's generated for you when you make your first request (like
retrieving the entire flow). You should continue to use this client id with
all subsequent requests. In order for a mutable request to be accepted, a
client must either have the current version or the client id that last
modified the flow. The second check allows clients to submit requests
asynchronous without having to wait for preceding requests to complete.

I am guessing that based on your error message your not including a client
id in your request and your revision is not current. Each successful
mutable request will contain the updated revision in the response.

Let me know if this helps. If not, could you send the requests your making?

Thanks!

Matt

On Tue, Jan 19, 2016 at 11:48 AM, <ph...@orange.com> wrote:

> Hello,
>
> My  nifi version  :  nifi 0.4.1
>
>
>
> I try to control a nifi topology with REST API  (java  jaxRS client ).
>
> I  have a Nifi group of 2 processors and I can retrieve the  json config
> for each of them .  perfect !
>
> But when  I modify the json config ( Input Directory for my  getfile
> processor instance) and  use REST PUT API to update  the proc config,
>
> I get back these messages :
>
>
>
> : HTTP status code : 409
>
> : This NiFi instance has been updated by 'anonymous'. Please refresh to
> synchronize the view.
>
>
>
>
>
> And the config of the processor is not updated  ( checking it with GUI,
> doing a manual refresh status  and also a REST get)
>
> Any idea ?  problem of user auth?
>
>
>
> Best regards
>
> Philippe
>
>
>
>
>
>
>
>
>
> _________________________________________________________________________________________________________________________
>
> Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
> pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
> a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
> Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.
>
> This message and its attachments may contain confidential or privileged information that may be protected by law;
> they should not be distributed, used or copied without authorisation.
> If you have received this email in error, please notify the sender and delete this message and its attachments.
> As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
> Thank you.
>
>

RE: control nifi processors with REST (ie without GUI)

Posted by ph...@orange.com.
Hello Matt
Thanks for the  article .. exactly in the scope ☺
I will check my clientId
philippe

De : Matt Gilman [mailto:matt.c.gilman@gmail.com]
Envoyé : mardi 19 janvier 2016 20:21
À : users@nifi.apache.org
Objet : Re: control nifi processors with REST (ie without GUI)

Philippe,

This article [1] contains a section at the very bottom that describes the optimistic locking in more detail and even includes a nice sequence diagram example.

Matt

[1] https://community.hortonworks.com/content/kbentry/3160/update-nifi-flow-on-the-fly-via-api.html

On Tue, Jan 19, 2016 at 11:58 AM, Matt Gilman <ma...@gmail.com>> wrote:
Philippe,

NiFi employs an optimistic locking scheme that requires clients to pass in a revision when making a mutable request. The revision is comprised of a version (a number that increments with each modification) and a client id. The client id can be any string. Typically however, you'll use the client id that's generated for you when you make your first request (like retrieving the entire flow). You should continue to use this client id with all subsequent requests. In order for a mutable request to be accepted, a client must either have the current version or the client id that last modified the flow. The second check allows clients to submit requests asynchronous without having to wait for preceding requests to complete.

I am guessing that based on your error message your not including a client id in your request and your revision is not current. Each successful mutable request will contain the updated revision in the response.

Let me know if this helps. If not, could you send the requests your making?

Thanks!

Matt

On Tue, Jan 19, 2016 at 11:48 AM, <ph...@orange.com>> wrote:
Hello,
My  nifi version  :  nifi 0.4.1

I try to control a nifi topology with REST API  (java  jaxRS client ).
I  have a Nifi group of 2 processors and I can retrieve the  json config for each of them .  perfect !
But when  I modify the json config ( Input Directory for my  getfile processor instance) and  use REST PUT API to update  the proc config,
I get back these messages :

: HTTP status code : 409
: This NiFi instance has been updated by 'anonymous'. Please refresh to synchronize the view.


And the config of the processor is not updated  ( checking it with GUI, doing a manual refresh status  and also a REST get)
Any idea ?  problem of user auth?

Best regards
Philippe





_________________________________________________________________________________________________________________________



Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc

pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler

a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,

Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.



This message and its attachments may contain confidential or privileged information that may be protected by law;

they should not be distributed, used or copied without authorisation.

If you have received this email in error, please notify the sender and delete this message and its attachments.

As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.

Thank you.



_________________________________________________________________________________________________________________________

Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.


Re: control nifi processors with REST (ie without GUI)

Posted by Matt Gilman <ma...@gmail.com>.
Philippe,

This article [1] contains a section at the very bottom that describes the
optimistic locking in more detail and even includes a nice sequence diagram
example.

Matt

[1]
https://community.hortonworks.com/content/kbentry/3160/update-nifi-flow-on-the-fly-via-api.html

On Tue, Jan 19, 2016 at 11:58 AM, Matt Gilman <ma...@gmail.com>
wrote:

> Philippe,
>
> NiFi employs an optimistic locking scheme that requires clients to pass in
> a revision when making a mutable request. The revision is comprised of a
> version (a number that increments with each modification) and a client id.
> The client id can be any string. Typically however, you'll use the client
> id that's generated for you when you make your first request (like
> retrieving the entire flow). You should continue to use this client id
> with all subsequent requests. In order for a mutable request to be
> accepted, a client must either have the current version or the client id
> that last modified the flow. The second check allows clients to submit
> requests asynchronous without having to wait for preceding requests to
> complete.
>
> I am guessing that based on your error message your not including a client
> id in your request and your revision is not current. Each successful
> mutable request will contain the updated revision in the response.
>
> Let me know if this helps. If not, could you send the requests your making?
>
> Thanks!
>
> Matt
>
> On Tue, Jan 19, 2016 at 11:48 AM, <ph...@orange.com> wrote:
>
>> Hello,
>>
>> My  nifi version  :  nifi 0.4.1
>>
>>
>>
>> I try to control a nifi topology with REST API  (java  jaxRS client ).
>>
>> I  have a Nifi group of 2 processors and I can retrieve the  json config
>> for each of them .  perfect !
>>
>> But when  I modify the json config ( Input Directory for my  getfile
>> processor instance) and  use REST PUT API to update  the proc config,
>>
>> I get back these messages :
>>
>>
>>
>> : HTTP status code : 409
>>
>> : This NiFi instance has been updated by 'anonymous'. Please refresh to
>> synchronize the view.
>>
>>
>>
>>
>>
>> And the config of the processor is not updated  ( checking it with GUI,
>> doing a manual refresh status  and also a REST get)
>>
>> Any idea ?  problem of user auth?
>>
>>
>>
>> Best regards
>>
>> Philippe
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> _________________________________________________________________________________________________________________________
>>
>> Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
>> pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
>> a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
>> Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.
>>
>> This message and its attachments may contain confidential or privileged information that may be protected by law;
>> they should not be distributed, used or copied without authorisation.
>> If you have received this email in error, please notify the sender and delete this message and its attachments.
>> As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
>> Thank you.
>>
>>
>

RE: control nifi processors with REST (ie without GUI)

Posted by ph...@orange.com.
Hello thanks everybody for  your answers

The request is a  put request from a Jax rs client java
………..
response = webResource.type("application/json").put(ClientResponse.class, returnedJSONProcessor1Updated);
…………
with returnedJSONProcessor1Updated ( see the gist pls)
https://gist.github.com/pgibert/1fdd1d7bf8de4c9bda4e

best regards
philippe

De : Matt Gilman [mailto:matt.c.gilman@gmail.com]
Envoyé : mardi 19 janvier 2016 17:58
À : users@nifi.apache.org
Objet : Re: control nifi processors with REST (ie without GUI)

Philippe,

NiFi employs an optimistic locking scheme that requires clients to pass in a revision when making a mutable request. The revision is comprised of a version (a number that increments with each modification) and a client id. The client id can be any string. Typically however, you'll use the client id that's generated for you when you make your first request (like retrieving the entire flow). You should continue to use this client id with all subsequent requests. In order for a mutable request to be accepted, a client must either have the current version or the client id that last modified the flow. The second check allows clients to submit requests asynchronous without having to wait for preceding requests to complete.

I am guessing that based on your error message your not including a client id in your request and your revision is not current. Each successful mutable request will contain the updated revision in the response.

Let me know if this helps. If not, could you send the requests your making?


Thanks!

Matt

On Tue, Jan 19, 2016 at 11:48 AM, <ph...@orange.com>> wrote:
Hello,
My  nifi version  :  nifi 0.4.1

I try to control a nifi topology with REST API  (java  jaxRS client ).
I  have a Nifi group of 2 processors and I can retrieve the  json config for each of them .  perfect !
But when  I modify the json config ( Input Directory for my  getfile processor instance) and  use REST PUT API to update  the proc config,
I get back these messages :

: HTTP status code : 409
: This NiFi instance has been updated by 'anonymous'. Please refresh to synchronize the view.


And the config of the processor is not updated  ( checking it with GUI, doing a manual refresh status  and also a REST get)
Any idea ?  problem of user auth?

Best regards
Philippe





_________________________________________________________________________________________________________________________



Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc

pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler

a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,

Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.



This message and its attachments may contain confidential or privileged information that may be protected by law;

they should not be distributed, used or copied without authorisation.

If you have received this email in error, please notify the sender and delete this message and its attachments.

As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.

Thank you.


_________________________________________________________________________________________________________________________

Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.