I'm developping a Nifi custom processor and I would like to get the parent process-group identifier when I add my custom processor into the canvas.
I was able to get the processor identifier in the init method with context.getIdentifier() and then I tried to use an API call (/processors/{identifier}) in the onAdded method but the processor is not yet created so I get a response telling me the processor is unknown.
Is there another way to do it?
Thank you.
Related
I need to get my current process group identifier in order to send it to another tool.
I know that I can get it from the UI but I don't want to hardcode it.
And I don't want to use the Rest API because I want to get the identifier of the process group I'm currently executing.
Is there a way ? Like a core attribute which contains this identifier ?
Thanks.
In the below image we can clearly see the error in the Conversion_Batching processor. How can this error be transmitted to PutEmail so that the email recipients can clearly understand the error.
Below is the PutEmail configuration:
But ${error} is not getting the error from the previous processor and I am getting an empty mail with the subject correctly set as expected.
How can I do this?
NiFi currently does not have a feature where we can capture and pass exceptions/errors to the subsequent processors as attribute or flowfile content.
You can configure SiteToSiteBulletinReportingTask which Publishes Bulletin events using the Site To Site protocol. This will give you information such as bulletinsourceid, bulletinsourcename, bulletingroupname, bulletinmessage etc and based on this you can then send out alert notification emails.
Another way is like in your process group Conversion_Batching introduce attribute ${error} and set custom error messages wherever failure happens, and then you can use this attribute value in PutEmail processor, something like below,
I have some plugin's which are basically input and output type definitions. I have a generic controller which i can add to the mvc pipeline. All works fine.
but I'm having trouble setting the api version on this generic controller. I know you can set this based upon an attribute on top of the controller class. But since you can't have this dynamic (attribute) don't allow it, i have no way to set the version for each instance of the generic controller.
Currently i just compile the controller for each instance on runtime and register i using the roslyn compiler.
is there a way to set the api-version somewhere in the pipeline of registering controllers in the mvc pipeline and endup with different api versions endpoints.
This can be achieved by using the Conventions API. It was designed to support this exact type of scenario:
https://github.com/microsoft/aspnet-api-versioning/wiki/API-Version-Conventions
This will only work on closed-generics, but it shouldn't be too much work to make that happen. Here's a couple of basic examples:
// typed, closed generic
options.Conventions.Controller<GenericController<PlugIn1>>().HasApiVersion(1,0);
// untyped, closed generic
var controllerType = typeof(GenericController<>).MakeGenericType(new []{typeof(PlugIn1)});
options.Conventions.Controller(controllerType).HasApiVersion(1,0);
You can also author your own custom conventions a la IControllerConvention. This approach could be used to version all controllers that inherit from GenericController<>. Then you just need to add it to the conventions like this:
options.Conventions.Add(new PlugInControllerConvention());
Hopefully that's enough to get you started. Feel free to ask more questions.
I want to update my processor_group variable via a processor. Even ExecuteScript works. Can this be achieved?
You can only update the variable registry through the REST API, the same way the UI does.
It is a PUT to /process-groups/{id}/variable-registry:
https://nifi.apache.org/docs/nifi-docs/rest-api/index.html
Just as an update to this Answer:
The nifi url you need is (default basic nifi node):
http://[IP ADDRESS]:8080/nifi-api/
The full api url you need to POST an update to an attribute is:
http://[IP ADDRESS]:8080/nifi-api/process-groups/[Process Group ID]/variable-registry/update-requests
An example of the payload is:
{"processGroupRevision":{"clientId":"c530ce77-0174-1000-fb36-93fa5e92e574","version":6},"disconnectedNodeAcknowledged":false,"variableRegistry":{"processGroupId":"c53cdaff-0174-1000-7922-5285dec53a94","variables":[{"variable":{"name":"authToken","value":"test3"}}]}}
To learn more about the payload, do some variable work in your NiFi UI and watch your developer tools for the "update-requests" entries and pay attention to the [Process Group ID] and the Payload.
I am trying to use the rest API to dynamically update and control my Apache NiFi Flow. I am using Postman to explore the REST API but am having trouble deleting properties/descriptors.
My current process is to call a GET to this address - http://localhost:8080/nifi-api/processors/{ID}
I then modify the response as desired and do a PUT with the modified response as the body. If I add a descriptor or change the content of a descriptor it works ok. But if I try to delete a descriptor by removing it from the properties and descriptors area then nothing happens.
I still get a 200 OK response, but it is the same as the original.
I am using NiFi 1.1.2 on Windows.
The PropertyDescriptors are specified by the Processor in question. These are read-only values and describe the properties the Processor currently supports. In you want to remove a property, and it is optional, you should be able to remove the value for it by setting it's entry to null in properties object in your request.