Support Questions

Find answers, ask questions, and share your expertise

[NiFi] To count the appearance of a particular word in 10 seconds.

avatar
Explorer

Hi,

 

I'm writing this to get a solution for the problem, where a stream of messages are sent and I want to count the word "Apples" in the stream of data, let's say in a window of 10 seconds. 

 

I tried AttributeRollingWindow but couldn't got the desired response.

 

Thanks in Advance,

 

2 REPLIES 2

avatar
Explorer

if working example of attributeRollingWindow is there, that would be of help too.

 

Thanks,

 

avatar
Master Collaborator

You can write a simple custom processor which uses local caching (like Caffeine cache implementation) with cache expiry time as ur window time and build the logic.

May be you can store words in cache and keep updating the count or something like that