Created 06-12-2019 11:31 AM
Is there a way to clear the state of a processor using another processor or groovy scripting (in an ExecuteStateProcessor) ?
The goal is to reset the state of a ScrollElasticSearchHttp processor to be able to run it more than once.
Important. I don't want do it manually using the UI ("state management" then "clear state", as it is explained in https://community.hortonworks.com/questions/64405/nifi-clear-state.html)
I want this operation be done after a scroll execution.
Refer the nifi doc : https://help.syncfusion.com/data-integration/processors/scrollelasticsearchhttp
...Scrolls through an Elasticsearch query using the specified connection properties. This processor is intended to be run on the primary node, and is designed for scrolling through huge result sets, as in the case of a reindex. The state must be cleared before another query can be run.
...
But how do that ?
Thanks by advance.
Created 06-12-2019 08:06 PM
You can use NiFi RestApi /processors/{id}/state/clear-requests call, to clear the state stored in the processor.
We can make restapi call by using invokehttp processor (or) groovy script and triggered by using NiFi.
Created 06-12-2019 08:06 PM
You can use NiFi RestApi /processors/{id}/state/clear-requests call, to clear the state stored in the processor.
We can make restapi call by using invokehttp processor (or) groovy script and triggered by using NiFi.
Created 06-13-2019 01:01 PM
Thank you Shu !
It seems to solve my problem. I can't test it now because of an error when retrieving the state("Failed to obtain value from ZooKeeper for component with ID 8a2d3c3d-5eb5-1331-8be1-6f5fda823456 with exception code CONNECTIONLOSS").
But it's on my side now.
Thanks again.
Created 05-29-2020 08:11 AM
@Shu_ashu
this approach works has a problem that clear-state is working only on stopped processor.
I am using ScrollElasticsearch processor and it needs to be cleared before it can be executed again.
I tried
curl -i -X POST http://localhost:8080/nifi-api/processors/0172101b-be82-11aa-1249-d1383cb1ceba/state/clear-requests
but it end-up with conflict status
I must stop processor in order to clear-state
Do I really have to stop processor? manually or via API - it doesn't seems to me as a good design.
Could you Help or give any advice please?
Thank u.
Petr