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

ASF GitHub Bot commented on NIFI-2299:
--------------------------------------

Github user joewitt commented on the issue:

    https://github.com/apache/nifi/pull/753
  
    It is in there.  https://issues.apache.org/jira/browse/NIFI-2299
    You should be all set to do fun things.


> Add standard services API dependency to Scripting Processors   
> ---------------------------------------------------------------
>
>                 Key: NIFI-2299
>                 URL: https://issues.apache.org/jira/browse/NIFI-2299
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Extensions
>    Affects Versions: 0.7.0, 0.6.1
>            Reporter: sumanth chinthagunta
>            Assignee: Joseph Witt
>              Labels: Scripts, groovy
>             Fix For: 1.0.0
>
>
> Scripting Processors cannot used Controller Services such as 
> *DistributedMapCacheClientService* etc, as required dependencies are missing 
> for *ExecuteScript* Nar. By adding following dependencies we can open new 
> possibilities for Scripting Processors.  
> Add this dependency to 
> nifi/nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-nar/pom.xml
> {code}
> <dependency>
>     <groupId>org.apache.nifi</groupId>
>     <artifactId>nifi-standard-services-api-nar</artifactId>
>     <type>nar</type>
> </dependency>
> {code}
> Add this dependency to 
> nifi/nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/pom.xml
> {code}
> <dependency>
>     <groupId>org.apache.nifi</groupId>
>     <artifactId>nifi-distributed-cache-client-service-api</artifactId>
> </dependency>
> {code}
> Then we can create scripting processor like:
> {code}
> import org.apache.nifi.controller.ControllerService
> import com.crossbusiness.nifi.processors.StringSerDe
> final StringSerDe stringSerDe = new StringSerDe();
> def lookup = context.controllerServiceLookup
> def cacheServiceName = DistributedMapCacheClientServiceName.value
> log.error  "cacheServiceName: ${cacheServiceName}"
> def cacheServiceId = 
> lookup.getControllerServiceIdentifiers(ControllerService).find {
>     cs -> lookup.getControllerServiceName(cs) == cacheServiceName
> }
> log.error  "cacheServiceId:  ${cacheServiceId}"
> def cache = lookup.getControllerService(cacheServiceId)
> log.error cache.get("aaa", stringSerDe, stringSerDe )
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to