Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
Description
Many users have asked for a way to obtain dynamic database connections. Essentially being able to use the existing SQL processors like PutSQL, etc, and be able to pass in flow file attributes to the DBCPService to obtain a connection based on the attributes.
The current DBCPService interface has a single method:
Connection getConnection()
Since there is no way for a processor to pass in any information, we can add an additional method to this interface and make the interface like this:
Connection getConnection(Map<String,String> attributes) default Connection getConnection() { return getConnection(Collections.emptyMap()); }
This would leave it up to the implementations of DBCPService interface to decide if they want to use the attributes map for anything.
The DBCPConnectionPool would not use the attributes map and would continue to provide a fixed connection pool against a single data source.
A new implementation can then be created that somehow maintains multiple connection pools, or creates connections on the fly.
The PropertyDescriptors in each implementation should indicate how they use expression language.
For example, since DBCPConnectionPool will not use the attribute map, it's property descriptors will indicate expression language scope as variable registry only:
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
The dynamic implementations should indicate:
.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBURES)
Attachments
Issue Links
- links to