Inter-process messaging between two Python programs

We have two Python programs running on two Linux servers. Now we want to send messages between these Python programs. The best idea is to create a TCP / IP architecture and a client architecture, but this seems like a very complicated way to do it. Is this really the best practice for this?

+4
source share
3 answers

I like zeromq for easy messaging, it is very light and fast ... very flexible. Using AMQP messaging is not a bad idea, or depending on the specifics of your situation, I found kombu to be a very nice pythonic library for this. You can also use xmlrpclib or configure a simple REST API using bottle or flask . Each option has a place, so I would study all your options.

+6
source

It really depends on the type of messaging you want and the role of the two processes. If this is the correct client / server, I would probably create SimpleHTTPServer and then use HTTP to exchange data between them. You can also use XMLRPCLib and the client to talk between them. Manually creating a TCP server with your own protocol sounds like a bad idea to me. You can also consider using a message queuing system to communicate between them.

+3
source

You may have mulitprocessing.managers . As doc reports: β€œThe manager object manages the server process that manages the shared objects. Other processes can access the shared objects using a proxy.”

In your case, you can create a master process that will manage your other processes, each of these processes will call a wizard to capture data.

0
source

All Articles