Skip to main content

Hi

I need to connect to a WebSocket which will send me hundreds of messages in a TEXT format. Those messages need to be acknowledged so the web socket stops sending the same messages overtime. To acknowledge those messages, I need to send an identifier back to the Origin service in a self contained WebSocket text message.

So far, my pipeline is as per below:

 

However, I realized the “Send response to Origin” was not sending back the identifier to the WS.

After reading the documentation, it seems that I could only use this block in a microservice pipeline. But the microservice pipeline works on origins which listen/read JSON-formatted data. And that’s where I am blocked. Indeed, my messages from the Web sockets are NOT in JSON and it s not a REST service.

Is there a way to send a text message back to a Web socket in Streamset? So I can properly ACK each message that have been processed successfully.

Thank you 

You can use the WebSocket destination to send data back. You will just need to configure it the same way as your origin. https://docs.streamsets.com/portal/platform-datacollector/latest/datacollector/UserGuide/Destinations/WebSocketClient.html


@sam I have seen this destination but there are 2 issues:

  • there is nowhere in the configuration of the destination to send a text message
  • is not this going to open a new web socket instead of reusing the same one

You can use the Data Format of “Text” to send a text message.

It will open a second WebSocket connection, it doesn’t reuse the connection.


The problem is that i m supposed to use the same web socket connection:

The WebSocket established with the URL is a textual bi-directional connection using UTF-8 encoding. The WebSocket service sends a sequence of notifications to the consumer and the consumer should send back a short acknowledgement over this connection for each notification received. This acknowledgement is for a particular notification and the server will periodically resend a notification until it is acknowledged. This will cease once the server has received and processed an acknowledgement for a particular notification.

 

Is this at all possible with Streamset DC?


If your server requires that the acknowledgement be sent using the same connection, then this cannot be done with Data Collector. Please test that it must use the same connection, many systems will still work if the acknowledgement is sent with a separate connection.


For anyone in the future, note that the WebSocket server can send responses back to the origin, but it always uses XML or JSON. https://docs.streamsets.com/platform-datacollector/latest/datacollector/UserGuide/Origins/WebSocketServer.html


I will check with the team if necessary for same connection or not.

In the meantime, the destination is giving me the below error for each messages, I dont understand what the error is?

 


Please ask the error message question as a separate question and include the detail of the configuration. This will help the right people see it.


Reply