nifi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Prasad, Rishab" <>
Subject How can I pass a flowfile attribute to a controller service?
Date Tue, 10 Apr 2018 10:57:18 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:-
jdbc:mysql://localhost:3306/test,com.mysql.jdbc.Driver,C:\Program Files\MySQL\mysql-connector.jar,root,root
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?

Thanks & Regards,

Rishab Prasad | Associate Software Engineer
Asia Pacific Financial Services Delivery Center - Deutsche Bank
CGI, E-City, Tower 2, No. 95/1 & 95/2,
Electronic City Phase I (West), Bangalore,
INDIA - 560 100 | Mob : +91-8520831736
[Description: Description: Description: Description: environment-logo-email]

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