Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
fedsp
Contributor
Contributor

Websockets - JSON API best pratices with microservices?

Hi!

I'm developing a solution based on microservices (aws lambda), which are basically small python codes which runs in a non managed infrastructure and got destroyed after that and I only pay by the time which the python code token to run.

I'm using that to retrive information from my qlik sense objects and store it somewhere else using the JSON API/ websockets. 

The point is:
Because of the micro service nature, I can run 1,5, 10 instances in parallel. I'm wondering how would be the best pratices to deal with this paralelism working with the websockets from the JSON API, as currently I'm facing this error a lot of times:

File "/opt/python/lib/python3.7/site-packages/websocket/_socket.py", line 126, in recv "Connection is already closed.") websocket._exceptions.WebSocketConnectionClosedException: Connection is already closed.

 

This is the piece of iteraction which created the error:

        req = {
            "id":self.id,
            "jsonrpc": "2.0",
            "method": "OpenDoc",
            "handle": req_handle,
            "params": [
                f"{qs_app_id}"
            ]
        }
        self.ws.send(json.dumps(req))
        authentication = self.ws.recv()
        connection = self.ws.recv()

 

I might be missing a best pratice dealing with those parallel extractions, right?
Thank you in advance!

0 Replies