[ 
https://issues.apache.org/jira/browse/NIFI-12544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18010036#comment-18010036
 ] 

Marek Burkoň edited comment on NIFI-12544 at 7/25/25 9:04 PM:
--------------------------------------------------------------

Hello  [~exceptionfactory] ,
I had to solve my problem of receiving SSE messages, so I wrote a processor in 
python extension quickly, which is not perfect, but it works for receiving 
messages.
Maybe it can help you to create a standard NAR processor or use this processor 
as inspiration for own code for anybody, like [~renlor] 

 [^SSE-client.py]

Content of file requirements.txt (one line):   sseclient-py
And file:  "__init__.py" is empty

P.S. NiFi is a beautiful tool

Marek


was (Author: JIRAUSER310564):
Hello  [~exceptionfactory] ,
I had to solve my problem of receiving SSE messages, so I wrote a processor in 
python extension quickly, which is not perfect, but it works for receiving 
messages.
Maybe it can help you to create a standard NAR processor or use this processor 
as inspiration for own code for anybody, like [~renlor] 

 [^SSE-client.py]

Content of file requirements.txt (one line):   sseclient-py
And file:  {_}__{_}init__.py is empty

P.S. NiFi is a beautiful tool

Marek

> Support receiving HTTP SSE (Server Sent Events)
> -----------------------------------------------
>
>                 Key: NIFI-12544
>                 URL: https://issues.apache.org/jira/browse/NIFI-12544
>             Project: Apache NiFi
>          Issue Type: Improvement
>            Reporter: Justin
>            Priority: Major
>         Attachments: SSE-client.py
>
>
> Currently NiFi has no processor which supports long poll type HTTP 
> connections, InvokeHTTP expects that every http request will terminate 
> shortly and does not forward intermediate results for long-lived connections 
> instead hanging until the read timeout is reached and then erroring the 
> request.  This makes it difficult to connect to any system which utilizes the 
> SSE standard to stream events to clients as they happen from NiFi, requiring 
> a script processor or external tool to convert the SSE stream into something 
> NiFi can handle.  Since streaming data processing (streaming events) is 
> NiFi's MO, it seems appropriate that there would be a native processor which 
> can connect and stream these types of events.
> I also have need of such a processor and would like to upstream the changes, 
> hence the ticket before I get too far into an implementation.
> A couple possibilities for implementing these changes:
>  * Extend InvokeHTTP to support streaming content when enabled in processor 
> options, thus it would forward content as it arrives, possibly broken apart 
> via a delimiter/parse config.  This would only timing out connections that 
> don't make progress in so long (read timeout limits).
>  * Add a new processor which is SSE specific which does all of the Proxy, 
> Auth, ... work of InvokeHTTP, but outputs SSE events roughly as they arrived 
> instead of a single HTTP response per input request.  Should this accept 
> configuration via FlowFile or be an INPUT_FORBIDDEN processor where 
> everything is through Configuration?  How do you close a stream 
> programmatically if configured via FlowFile?
>  * Create a new HTTP processor which has some level of support/awareness of 
> content types (application/stream+json, application/x-ngjson, 
> text/event-stream, ...) and doesn't time out long connections unless they 
> aren't making progress, would output blocks in some predefined size or by a 
> delimiter and rely on downstream to decide what to do with the content.
> Ref: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to