nifi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rishab Prasad <>
Subject How can I pass a flowfile attribute to a controller service?
Date Tue, 10 Apr 2018 10:45:24 GMT
Hi Team,

Following are the combination of processors that I am using:-

GetFile + SplitText + ExtractText + UpdateAttribute + ExecuteSQL +
ConvertAvroToJson + PutFile

Basically,I have a properties file which contains 5 comma separated values
that are required by the 'DBCPConnectionPool' controller service to
establish connection with the database. Here is the content of my
properties file:-


Now, I am extracting the values from this properties file and storing them
in manually created properties.I am using this regex to store that values
into attributes using ExtractText.

ExtractedData: (.*)

Then use updateAttribute processor to manually add 5 properties and get
their values from the properties file like below:

connectionURL  : ${ExtractedData:getDelimitedField(1)}
driverClass    : ${ExtractedData:getDelimitedField(2)}
driverLocation : ${ExtractedData:getDelimitedField(3)}
user           : ${ExtractedData:getDelimitedField(4)}
password       : ${ExtractedData:getDelimitedField(5)}

So, by now the attributes have got their values from the properties file
and thus following values stored in them:

connectionURL  : jdbc:mysql://localhost:3306/test
driverClass    : com.mysql.jdbc.Driver
driverLocation : C:\Program Files\MySQL\mysql-connector.jar
user           : root
password       : root

Finally, Here is what I am trying to achieve. I am trying to use these
above 5 attributes in the DBCPConnectionPool Controller Service like this:

 Database Connection URL     : ${connectionURL}
 Database Driver Class       : ${driverClass}
 Database Driver Location(s) : ${driverLocation}
 Database User               : ${user}
 Password                    : ${password}

But I am unable to establish the connection and I am getting the error
'Cannot create PoolableConnectionFactory'. It seems that the controller
service is unable to read the value from the attributes. How can I pass a
flowfile attribute to a controller service?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message