Member since
10-05-2022
20
Posts
6
Kudos Received
2
Solutions
My Accepted Solutions
Title | Views | Posted |
---|---|---|
376 | 10-27-2024 09:53 AM | |
641 | 04-07-2023 12:32 AM |
04-07-2023
12:32 AM
2 Kudos
Just for everyones information; There was nothing wrong with the code. It was simply that the docker image I used to run Nifi did not build properly and therefore my modifications weren't taken into account.
... View more
04-04-2023
02:35 AM
Hello friends, I wrote a custom processor and now wanted to add a custom controller. The problem is, that the properties I wrote for the controller do not appear when I create the service. I followed the structure of this controller: https://github.com/Automna/NiFi/blob/master/nifi-rel-nifi-1.1.2/nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/main/java/org/apache/nifi/dbcp/DBCPConnectionPool.java Here is what I did so far: public class MyNewControllerService extends AbstractControllerService implements MyControllerService {
public static final PropertyDescriptor USERNAME = new PropertyDescriptor.Builder()
.name("Username")
.expressionLanguageSupported(ExpressionLanguageScope.NONE)
.displayName("Set username")
.required(true)
.defaultValue("User")
.description("Username to login to graph service")
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
.build();
public static final PropertyDescriptor PASSWORD = new PropertyDescriptor.Builder().
name("Password")
.expressionLanguageSupported(ExpressionLanguageScope.NONE)
.displayName("Set password")
.required(true)
.defaultValue("password")
.description("Password to login to graph service")
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
.build();
public static final PropertyDescriptor URL = new PropertyDescriptor.Builder().
name("ApiUrl")
.expressionLanguageSupported(ExpressionLanguageScope.NONE)
.displayName("Set url")
.required(true)
.defaultValue("url")
.description("Full url to api")
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
.build();
private static final List<PropertyDescriptor> properties;
static {
final List<PropertyDescriptor> props = new ArrayList<>();
props.add(USERNAME);
props.add(PASSWORD);
props.add(URL);
properties = Collections.unmodifiableList(props);
}
OkHttpClient client = new OkHttpClient();
private static ObjectMapper mapper = new ObjectMapper();
@Override
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
return properties;
}
@OnEnabled
public void onConfigured(final ConfigurationContext context) throws InitializationException {
final String user = context.getProperty(USERNAME).getValue();
final String password = context.getProperty(PASSWORD).getValue();
final String url = context.getProperty(URL).getValue(); What is missing that I only get a blank properties page?
... View more
Labels:
- Labels:
-
Apache NiFi
01-11-2023
07:58 AM
Hello, I cannot find an answer on the www to my following question. I have tried splitjson and jolttransform to achieve my desired outcome, but nothing does the trick. My input file looks like this: { "BVjsoBHDSI" : { "date" : "2021-04-08", "description" : "blabla1", "number" : 40 }, "FudNSk" : { "date" : "2021-09-26", "description" : "blabla2", "number" : 80 }, "Cfjdsl54fd" : { "date" : "2022-05-10", "description" : "blablubb", "number" : 31 } } Actually I just want to split the stupid thing, but since the root level has a different individual value nifi doesn't understand what I want to do. The idea was to use a jolt transform to add a key "id" with the original key as value. I can't figure out a proper specification though. Glad to hear your ideas. Desired output: { "BVjsoBHDSI" : { "date" : "2021-04-08", "description" : "blabla1", "number" : 40, "id" : "BVjsoBHDSI" }, "FudNSk" : { "date" : "2021-09-26", "description" : "blabla2", "number" : 80, "id" : "FudNSk" }, "Cfjdsl54fd" : { "date" : "2022-05-10", "description" : "blablubb", "number" : 31, "id" : "Cfjdsl54fd" } } Then I could easily overwrite the root and split the flowfile as usual.
... View more
Labels:
- Labels:
-
Apache NiFi
12-01-2022
02:33 AM
Hi, thanks for the details. Unfortunately it is not working. I get an empty array [] as output. I have tried it with extract and split mode. I applied the schema text property as suggested with "NestedKey" and "nestedValue" as name. None gives me an output. Meanwhile I have achieved what I wanted using SplitContent and then again another jolt processor. Of course it would be more elegant if I could make it work with ForkRecord.
... View more
11-30-2022
01:36 AM
Hi, thanks for your suggestions. I don't know a lot about nifi, so it took me long enough to figure out how to find the correct jolt transformation to obtain the structure above. Unfortunately I also don't know how to configure the record writer properly. I can't find a good manual or examples on the web. Which strategy do I choose? What field can I give my wanted schema to?
... View more
11-25-2022
02:41 AM
Hello, unfortunately I couldn't find an answer for this question, although it seems to be easy enough. I have a json file of this format, which I want to generate separate flowfiles from singularizing the values in NestedKey2: My input: { "Key1" : [ { "NestedKey1" : "Value1", "NestedKey2" : [ "Value2", "Value3", "Value4", "Value5"], "NestedKey3" : "Value6" } ] } Desired output: Flowfile 1: { "Key1" : [ { "NestedKey1" : "Value1", "NestedKey2" : "Value2", "NestedKey3" : "Value6" } ] } Flowfile 2: { "Key1" : [ { "NestedKey1" : "Value1", "NestedKey2" : "Value3", "NestedKey3" : "Value6" } ] } ... and so on. Thanks for any suggestions.
... View more
Labels:
- Labels:
-
Apache NiFi
10-06-2022
07:56 AM
Thanks for your reply!! I would need something like if url_value:contains("webpage1") set api_value to "wepage1" elseif url_value:contains("webpage2") set api_value to "webpage2" and so on and so forth I don't see how I can do that using JOLT
... View more
10-06-2022
07:53 AM
Thanks for your replies!! I forgot to mention, the first value contains the value needed for my url_value. That's why I need rules as you can set in the UpdateAttribute. I have something like "www.webpage.com/sites " and need to extract "webpage" for my api_value. I don't see how I can do this with ReplaceText or with JOLT. I would need something like if url_value:contains("webpage1") set api_value to "webpage1" elseif url_value:contains("webpage2") set api_value to "webpage2" and so on and so forth
... View more
10-06-2022
06:52 AM
Hello there, I have flowfiles with json content, which I transform before using them to send a post request with InvokeHTTP. I have an attribute "url_value" which I can use to determine my "api_value". For now I use EvaluateJsonPath to add those values to the flowfile attributes, then I use UpdateAttribute where I have set some rules to get the correct api_value. Now my question: how do I get the value back into my content? If I use AttributesToJSON, it overrides all previous content, therefore I need to have extracted all necessary attributes with EvaluateJsonPath before. This is not a very elegant solution since there can be many entries and I actually only need to update one of them! Is there no processor similar to UpdateAttribute but for flowfile content? How could I use JoltTransformJSON to change a value depending on another attribute? Edit: I would need something like if url_value:contains("webpage1") set api_value to "wepage1" elseif url_value:contains("webpage2") set api_value to "webpage2" and so on and so forth I appreciate any hints. Thanks
... View more
Labels:
- Labels:
-
Apache NiFi
10-05-2022
08:15 AM
Hi, for me this is not working. My desired attribute remains unchanged after it undergoes the UpdateAttribute processor. What could be the cause of this? I have a property called "api" with the default value "web page". My rule is ${url:contains('webpage')} and the action "api" and "web page". The "url" property contains the address as in "https://www.webpage.com/site". Any ideas what I should check?
... View more
- « Previous
-
- 1
- 2
- Next »