[deprecated] A lovely message queue
Erlang Go
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bench
src
Makefile
README.md
dbg_tracer.erl
errlog.config
license

README.md

MeeQo

MeeQo is an open source message queue. I got most ideas about it from ZeroMQ and take the advantages of Erlang , which is currently my favourite programming language, to implement a more easy-to-use message queue. MeeQo is just an encapsulation of BSD socket with no supports of subject and filter. There are only two protocols, read-send and tweet. You CANNOT mix them in one TCP connection and there is no need to do so. I HATE tedious user mannual, so just read the following examples, which will help you understand ALL the usages.


Start two MeeQo instances on port 6611 and 6613 respectively. The port number MUST be odd.

/path/to/meeqo$ mkdir ebin && make
/path/to/meeqo$ erl -pa ebin
Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.9.1 (abort with ^G) 1> meeqo:start_link(6611). {ok,<0.43.0>} 2> meeqo:start_link(6613). {ok,<0.51.0>} 3>

The format of read-send protocol is as follows. Any character can be inserted between first two "[" and last two "]" only if the message body can be distinguished, e.g. [@#[Hello]]MeeQo]@#], of which the message body is Hello]]MeeQo. This is a trick of Lua syntax. What is more, message can be sent in multiple continuous TCP packets. (Refer the second message.) After all the data in a single message is sent to MeeQo, a reply "ok" will be return.

read                            - Read the first message and delete it from MeeQo.
read IP:port                    - Read the first message from IP:port and delete it from MeeQo.
send IP:port [...[message]...]  - Send a message to MeeQo at IP:port.

PLEASE DO NOT ENTER REDUNDANT WHITESPACES.
~$ ncat 192.168.3.139 6611
send 192.168.3.139:6613 [[The First Message]]
ok
send 192.168.3.139:6613 [[The First Line of The Second Message
The Second Line of the Second Message]]
ok
^C
~$ ncat 192.168.3.139 6613
read
The First Message
read 192.168.3.139:6611
The First Line of The Second Message
The Second Line of the Second Message
send 192.168.3.139:6611 [[I got two messages from you]]
ok
^C
~$ ncat 192.168.3.139 6611
read
I got two messages from you
^C

Different from the former protocol, we can tweet multiple messages in one TCP packet, or more exactly, in one TCP connection. But each message MUST end with a null character('\0'), which means the message body cannot contain it. You can input it in CLI by pressing <C-2>.

~$ ncat 192.168.3.139 6611
tweet 192.168.3.139:6613 Message One^@
tweet 192.168.3.139:6613 Message Two^@tweet 192.168.3.139:6613 Message Three^@
tweet 192.168.3.139:6613 "^@" is null character.^@
^C
~$ ncat 192.168.3.139 6613
read
Message One
read 192.168.3.139:6611
Message Two
read
Message Three
read
"^@" is null character.
^C

This is how to use MeeQo via Ncat. You can implement such a client with a few lines of code in Java or Python, etc.


Benchmark


 100,000 | 8 bytes | 64 bytes
---------|---------|----------
   send  |  10.36s |  10.95s
---------|---------|----------
   read  |   9.80s |   9.96s
---------|---------|----------
  tweet  |   0.85s |   2.33s