Forums

ZeroMQ possible or not

Hi guys - I just recently learned about ZeroMQ (and RabbitMQ). From my basic understanding so far, it looks like something would have to be installed in addition to a python language binding library used in my apps. Am I correct then that it is not possible to run ZeroMQ in PythonAnywhere?

One reason I was looking at ZeroMQ is for a microservices style architecture. I guess I could run a bunch of web apps for this or maybe something through scheduler. I'd need to establish a way for each service to communicate and if web services it could be a API. Any thoughts on this is appreciated to help with my understanding. Thank you.

Hi there,

I can confirm that you can run zeromq on pythonanywhere (I just setup something to talk between a console server and a task server). However, it is a bit of hacky- you need to use the internal ip address of the servers.

So it is definitely possible as a learning exercise. I would not recommend it for production, especially if you would worry about the queued messages being lost etc. (because zeromq does not offer persistence out of the box) Also the relevant ip addresses may change.

Try setting up a console-console zeromq socket first.

For multiple webapps, it might be trickier but also cooler- you could actually just connect through their domain names instead of IP address- in which case the most hacky part would be avoided. However, your webapp code is only called and run when it receives a request, and is expected to finish running in say <10min. So it would say be able to send a simple message (zmq.REQ), but wouldn't be able to run a simple zeromq server (zmq.REP). I'm not sure about the other zeromq patterns. You could for example have a long running script on the scheduled task server coordinating everything.

Thank you Conrad for trying this and giving some idea of the overall implementation in the other formats mentioned. Looks like I can do some learning and practice here to see if ZMQ is something I'd like to use long term. That is enough for my needs for now.