I want one application on a Linux(Server) host to communicate with applications on Win7(Client) in a VM. Lib of choice is ZeroMQ. But how do I manage asynchronous tasks?
Let me give an example: The application in the VM generates tasks in arbitrary intervals and sends them to the Linux box. This will process them but needs some time to answer. In this time the socket in REQ/REP pattern is blocked and incoming tasks from the WinApp can not be forwarded to the LinuxApp. How should I solve this? How is this generally solved, even without 0MQ. Do I have to make both to servers and clients and establish two connections?
Requirements:
Hence its not possible to achieve the REQ/REP/REQ/REP/... sequence.
Have a look at the several patterns described in the ZMQ Guide and see if one of them fits better than simple REQ/REP.
In general your server on the linux box seems to need implementation of ROUTER/DEALER pattern that will forward incoming tasks to a set of workers.
ZMQ has it's own topology compared to traditional socket based client/server solutions. Other solutions might be to implement a socket based server that uses a thread pool to forward the incoming tasks.
UPDATE: Since you've been precising on your requirements I think the majordomo pattern might be a good and reliable starting point for your purposes. There might be better fitting patterns as @gvd mentions in his comments.
As DevNoob says, the asynchronous client server pattern sounds like the one you need.
"LRU" means least-recently used, but I've removed that term from the latest text of the Guide, and am using "load-balancing" instead. Since the goal is to load-balance across a set of workers...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With