Member since
05-07-2018
6
Posts
1
Kudos Received
0
Solutions
05-24-2018
08:52 AM
Thank you @Bryan Bende! I thought variable registry could be modified on runtime to change workflow behavior. I think I'm not going to use the REST API to solve my design. It only implies penalization to the performance due to it is going to be done each time a new message from a sensor arrives. I could do the it obtaining those values from a DB but it has the same penalization. I will do a more static approach, routing with attributes and changing the design if the categories and/or the types of the sensors change.
... View more
05-23-2018
04:31 PM
I have create a ProcessGroup to update NifiFlow variables that receives the new values via MQTT using a json structure. Previously I have defined the variables in the scope of the NifiFlow with default values. To update the variables I use a EvaluateJsonPath configured as follow to process the json received. Later, I try to use those variables into a ExecuterScript but the are not accessible or I don't known how to access to them. This is the script (javascript): var flowFile = session.get()
if (flowFile != null) {
var categories = flowFile.getAttribute('root.sensors.categories').split(',')
var typesPerCategory = flowFile.getAttribute('root.sensors.types').split(';')
var sensorType = flowFile.getAttribute('sensor.type')
for (var i = categories.length; (--i) >= 0;) {
var types = typesPerCategory[i].split(',')
for (var j = types.lenght; (--j) >= 0;) {
if (types[j].equals(sensorType)) {
var topics = session.getAttribute(flowFile, 'root.sensors.topics').split(',')
flowFile = session.putAttribute(flowFile, 'topic', topics[i])
session.transfer(flowFile, REL_SUCCESS)
}
}
}
session.transfer(flowFile, REL_FAILURE)
}
... View more
05-16-2018
11:31 AM
Thank you @Shu again! I didn't know that attributes where accessible over the flow to use them later. I use the first approach.
... View more
05-16-2018
08:50 AM
I have an input that is a JSON from which I extract a property that is necessary to build a query against a DB. After I obtain the query results I need to join the result of the query with the rest of the information that is on the JSON from which I extracted a property to do the query. I extract the property with EvaluateJsonPath, after that I call ExecuteSQL and send the result to ConvertAvroToJSON but now I don't know to merge this with the previous JSON I have.
... View more
05-08-2018
11:17 AM
1 Kudo
Thank you @Shu! I already have the processor configured with the URI instead of the EL, but I supposed that I could use a variable to set the value of any property. Now, thank to you, I know for sure that I have to check if it support as value an EL.
... View more
05-08-2018
10:15 AM
I have defined a variable called "BrokerURI" in the scope of the main process group with the URI of a MQTT broker. The idea is to use this variable to simplify the configuration of several ConsumeMQTT process, setting their Broker URI properties as "${BrokerURI}". It is not working because there is an error. I thought it was possible to use it as I have done. Maybe I doing something wrong. Thanks in advance.
... View more