[
https://issues.apache.org/jira/browse/NIFI-2299?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mark Payne updated NIFI-2299:
-----------------------------
Resolution: Fixed
Status: Resolved (was: Patch Available)
> 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)