[
https://issues.apache.org/jira/browse/NIFI-4169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16083331#comment-16083331
]
Koji Kawamura commented on NIFI-4169:
-------------------------------------
With ConnectWebSocket, broadcasting messages would not be interesting at all,
since NiFi is a WebSocket client and talking to a single WebSocket server. In
this case, the size of the session wouldn't be grater than one. And there's no
difference between broadcasting or not.
The only benefit I can think of as a client is that, PutWebSocket doesn't have
to know websocket session id to send a message to the connected WebSocket
server from NiFi.
Broadcasting is useful when NiFi acts as WebSocket server with ListenWebSocket
processor. It can accepts multiple WebSocket clients to connect a NiFi. Then
some use case requires push notification to all connected WebSocket clients
from NiFi. For example, if a user want to show UI alert or notification when
NiFi receives some important message from a MessagingQueue or topic, then they
could write a Web App connecting to NiFi via WebSocket protocol to receive such
notification. And if there're multiple users using the same Web App, then NiFi
will have multiple WebSocket sessions and has to distribute the same
notification to every connected client.
In this context, even if NiFi couldn't send a message to a particular client,
we'd expect it to continue sending to other clients.
However, PutWebSocket doesn't care whether the session is for as a client or as
a server. So, I think following implementation would be reasonable for
PutWebSocket:
- Transfer the incoming FlowFile to success if it's sent to at least one target
- Continue looping through sessions even if one throws Exception
- Catch Exception while in the loop, then generate FlowFiles to send to
'failure' relationship. Embed failed websocket session id to
'websocket.session.id' FlowFile attribute
How do you think?
> PutWebSocket processor with blank WebSocket session id attribute cannot
> transfer to failure queue
> -------------------------------------------------------------------------------------------------
>
> Key: NIFI-4169
> URL: https://issues.apache.org/jira/browse/NIFI-4169
> Project: Apache NiFi
> Issue Type: Improvement
> Components: Extensions
> Affects Versions: 1.3.0, 1.4.0
> Reporter: Y Wikander
> Priority: Critical
> Labels: patch
> Fix For: 1.3.0, 1.4.0
>
> Attachments:
> 0001-websocket-when-sendMessage-fails-under-blank-session.patch
>
>
> If a PutWebSocket processor is setup with a blank WebSocket session id
> attribute (see NIFI-3318; Send message from PutWebSocket to all connected
> clients) and it is not connected to a websocket server it will log the
> failure and mark the flowfile with Success (rather than Failure) -- and the
> data is effectively lost.
> If there are multiple connected clients, and some succeed and others fail,
> routing Failure back into the PutWebSocket could result in duplicate data to
> some clients.
> Other NiFi processors seem to err on the side of "at least once".
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)