You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "sumanth chinthagunta (JIRA)" <ji...@apache.org> on 2016/07/18 04:00:24 UTC
[jira] [Created] (NIFI-2299) Add standard services API dependency
to Scripting Processors
sumanth chinthagunta created NIFI-2299:
------------------------------------------
Summary: 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: Bug
Components: Extensions
Affects Versions: 0.6.1, 0.7.0
Reporter: sumanth chinthagunta
Fix For: 0.8.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)