Member since
06-08-2017
1049
Posts
518
Kudos Received
312
Solutions
My Accepted Solutions
| Title | Views | Posted |
|---|---|---|
| 11196 | 04-15-2020 05:01 PM | |
| 7096 | 10-15-2019 08:12 PM | |
| 3088 | 10-12-2019 08:29 PM | |
| 11422 | 09-21-2019 10:04 AM | |
| 4313 | 09-19-2019 07:11 AM |
01-17-2018
12:02 PM
2 Kudos
@Richard Scott Yes it returns True as attribute value. ${anyDelineatedValue("${number_list}, ","):startsWith("1")} //split the numbers_list string with ,(based on delimiter) and check any of the number_list values is starting with 1 (or) not. As we are having just 1000 so number_list string then the expression language check for is the number_list any value is starting with 1 so the result is True. Example:- For ${anyDelineatedValue("${number_list}, ","):startsWith("1")} Case1:- number_list 1000,2000,3000
result True //because our expression language is checking for any of the delineated values and we are having 1000 which is starting with 1 so returns as True. Case2:- number_list 2000,2000,3000
result False //because any of the number list values are not starting with 1 so the result is False. In Addition You can evaluate the expression language by using Generate flowfile processor Configs:- Drag and drop generate flowfile processor Right click and click on Configure In properties tab click on + sign that is highlighted in above screenshot and add new property as number_list
1000 4.Click on Scheduling Tab and keep Timerdriven with Run schedule as 11111111110 (or) some big number, so the processor trigger 1 flowfile after those many sec that we have given in Run Schedule value. UpdateAttribute Configs:- Follow same steps as above and add new property as ad(your property name) ${anyDelineatedValue("${number_list}",","):startsWith("1")} After update attribute processor we are going to add ad attribute to the flowfile as result of expression that we mentioned i.e ${anyDelineatedValue("${number_list}",","):startsWith("1")} Output:- In above screenshot we are having ad attribute having value as true. Flow Screenshot:- Like this way you can test expression language using NiFi. . If the Answer helped to resolve your issue, Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of errors.
... View more
01-19-2018
08:29 AM
@Shu Thank you so much for your answer and for taking time to prepare an environment to test my PoC. I really appreciate that. My problem was that I was trying to read the Json with "JsonPathReader" service. Changing to "JsonTreeReader" made the trick. Anyway, I went forward with the PoC and now I'm sending the converted Avro data to a Kafka cluster and I'm trying to deserialize it after consuming. For all this, I'm using the Hortonworks schema-registry which works fine in Nifi but I can't get it to work in Java. I've tryied the example here but I'm getting an error at the time of declaring the deserializedObject. Here you can see the code: public void runAvroSerDesApis(byte[] serializedData, String name) throws IOException {
this.serializedData = serializedData;
this.name = name;
//using builtin avro serializer/deserializer
/*AvroSnapshotSerializer avroSnapshotSerializer = new AvroSnapshotSerializer();
avroSnapshotSerializer.init(config);*/
AvroSnapshotDeserializer deserializer = schemaRegistryClient.getDefaultDeserializer(AvroSchemaProvider.TYPE);
deserializer.init(config);
Object deviceObject = createGenericRecordForDevice(name);
SchemaMetadata schemaMetadata = createSchemaMetadata("avro-serializer-schema-" + System.currentTimeMillis());
//byte[] serializedData = avroSnapshotSerializer.serialize(deviceObject, schemaMetadata);
Object deserializedObj = deserializer.deserialize(new ByteArrayInputStream(serializedData), schemaMetadata, null);
LOG.info("Serialized and deserialized objects are equal: [{}] ", deviceObject.equals(deserializedObj));
}
The line retrieving the error is "Object deserializedObj = deserializer.deserialize(new ByteArrayInputStream(serializedData), schemaMetadata, null);" and it says more or less that "actual and format argument lists differ in lenght" Is there any example someone could provide about how to deserialize an Avro message in Java using Hortonworks Schema-Registry? I'm using v0.2.1. Thanks in advance.
... View more
01-15-2018
03:33 PM
1 Kudo
@Mark I have tried with same configurations as you mentioned in the question in extract text and in replace text processors, The output flowfile contents from replace text processor resulting with \ in it. Output:- Here is my configurations:- Extract Text:- Output from extract text processor:- abc attribute value having \ in it Replace Text:- As Regex Replace as Replacement Strategy (Or) Replacement Strategy as Always Replace Output:- Both of these Replacement strategies are resulting same output that i mentioned as first screenshot. Once check the attribute abc value after Extract Text processor having \ in it or not. If you still having issue then share your flow and configs of the processors please..
... View more
01-13-2018
05:51 AM
2 Kudos
Thanks @Shu For such a nice help.
... View more
01-13-2018
05:03 AM
1 Kudo
Thanks for your overwhelming response, this will help me a great.
... View more
01-12-2018
10:54 AM
1 Kudo
Yes, that was the solution! Thank you very much! Everything works fine with the following statement now: SELECT SUM(menge) menge FROM mytable
... View more
01-10-2018
03:16 AM
Thanks Lot @Shu for your details description explanation. My Flow now look like as below .Thanks Lot
... View more
01-04-2018
04:28 AM
1 Kudo
@Shu it worked Thanks a lot appreciate your help!!!. Apologies for the silly mistake, there was a space on the first line Thanks again
... View more
01-04-2018
05:25 PM
1 Kudo
Thanks! That seems to work correctly. I'll mark this as the answer as it produces the answer I'm looking for.
... View more
01-16-2018
03:41 PM
1 Kudo
Thank you this worked for me
... View more