Support Questions

Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

SSE Client in Apache NiFi

New Contributor

I was looking for a server sent event (SSE) client in Apache NiFi, however, I couldn't find any ready processor that can do that. 

 

I started implementing an SSE client using Python script and used ExecuteCommand processor to run this script. However, the script needs to be terminated in order to send the processor output to the next step through STDOUT. (ie. I can't use an infinite Loop "While True:" to listen to the SSE server and output the consumed events on stream).

 

Is there any ideas to implement the SSE client in NiFi such that consumed events are processed one by one to the next processors in real-time?

2 REPLIES 2

Cloudera Employee

you can technically run an infinite loop with python and just produce a print statement.  this will send out data.  

Expert Contributor

@mmaher22 You may want to run the python job inside of ExecuteScript.   In this manner, you can send output to a flowfile during your loops iterations with:

 

session.commit()

This command is inferred at the end of the code execution in ExecuteScript to send output to next processor (1 flow file).  So if you just put that in line with your loop, then the script will run, and send flowfiles for every instance.

 

For a full rundown of how to use ExecuteScript be sure to see these great articles:

 

https://community.hortonworks.com/articles/75032/executescript-cookbook-part-1.html

https://community.hortonworks.com/articles/75545/executescript-cookbook-part-2.html

https://community.hortonworks.com/articles/77739/executescript-cookbook-part-3.html

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.