[zeromq-dev] Introducing mqLua

Marc Balmer marc at msys.ch
Sun Jun 29 12:52:42 CEST 2014

If you are using Lua with ZeroMQ, mqLua might be of interest to you.

mqLua is a "different" way to execute Lua code, it combines the three technologies Lua, POSIX threads, and, 0MQ.  mqLua comes as a binary, called "mqlua", which takes a filename of a Lua program as argument.  This Lua program is meant to "orchestrate" a network of nodes.

nodes are created using the "node" module. Nodes are independent Lua states running in their own thread.  Nodes can communicate using 0MQ message queues.  The Lua states run in parallel and use up to all available CPU cores (this has nothing to do with Lua coroutines , which are still available to each Lua state).

A new Node (i.e. a Lua state running in its own thread) is created using node.create():

local n = node.create('worker.lua', 'bee', 42)

This will create a new thread with a new Lua state, running the chunk found in the file "worker.lua", passing the arguments "bee" and 42 in "..." to worker.lua.

Nodes can use the "zmq" module to communicate with each other.  So it is possible to run multiple independend Lua threads in one process and have them communicate with each other, or with Nodes in differents processes on the same machine, or with Nodes running on a remote machines.  The zmq binding closely follows the C binding.

The code can be found at https://github.com/mbalmer/mqlua

I plan to extend examples and documentation over time.

Comments, suggestions, and, ideas welcome.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140629/cbf564ff/attachment.htm>

More information about the zeromq-dev mailing list