You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Matt Burgess (JIRA)" <ji...@apache.org> on 2018/04/25 15:10:00 UTC

[jira] [Commented] (NIFI-5121) DBCPService should support passing in an attribute map when obtaining a connection

    [ https://issues.apache.org/jira/browse/NIFI-5121?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16452433#comment-16452433 ] 

Matt Burgess commented on NIFI-5121:
------------------------------------

Should probably update HiveDBCPService and the associated components as well.

> DBCPService should support passing in an attribute map when obtaining a connection
> ----------------------------------------------------------------------------------
>
>                 Key: NIFI-5121
>                 URL: https://issues.apache.org/jira/browse/NIFI-5121
>             Project: Apache NiFi
>          Issue Type: Improvement
>    Affects Versions: 1.6.0
>            Reporter: Bryan Bende
>            Priority: Minor
>
> 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:
> {code:java}
> Connection getConnection(){code}
> 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:
> {code:java}
> Connection getConnection(Map<String,String> attributes)
> default Connection getConnection() {
>   return getConnection(Collections.emptyMap());
> }{code}
> 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:
> {code:java}
> .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY){code}
> The dynamic implementations should indicate:
> {code:java}
> .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBURES){code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)