nifi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From KhajaAsmath Mohammed <mdkhajaasm...@gmail.com>
Subject Execute Script - Groovy get attribute
Date Wed, 03 Jun 2020 12:58:17 GMT
Hi,

I have followed the below link to wait for 100 files and then process the
next step.

https://community.cloudera.com/t5/Support-Questions/NiFi-Count-Fileflows-via-attribute/td-p/178860


This works well but my use case is that count number is dynamic. To test
the functionality, I have passed an attribute count to get the value. Below
script is not working. any help?

import org.apache.commons.io.IOUtils
import java.nio.charset.StandardCharsets
def trigger=session.get(1)
def flowFiles=session.get(99)
if (!trigger) return

*String attr=trigger.getAttribute("cnt");*


if(!flowFiles || flowFiles.size() < 7)
{
session.rollback()
}
else
{
session.transfer(trigger,REL_SUCCESS)
session.transfer(flowFiles,REL_FAILURE)

}

[image: image.png]

Here is the error I got.

Thanks,
Asmath

Mime
View raw message