OPQ
- An Open sourced Persistent message Queue
- Code is tested under go1.4.2 (CAUTION: OPQ hasn't been tested in production environment so far)
- Features1.persistent message storage2.push model - push message to target service and block when failure3.easy to use - simple API whith HTTP POST method, no addtional client integration is required4.message replay5.high performance aimed6.operations-friendly - graceful stop/restart, HA (TODO)
- Performance1.over 20,000(Message/Second) with 2K(Byte) message payload2.over 30,000(Message/Second) with 1K(Byte) message payload
Install
Download source code
go get -u github.com/LevinLin/OPQ
Build OPQ
cd /path/to/OPQgo build
Run OPQ
cd /path/to/OPQnohup ./OPQ &>/dev/null &
-debug
System runs in debug model when given debug=yes, which will enable log/output in debug level, default to no
-port
Listening port, default to 8999
-syslog
System log name, default to system.log
-admin
-admin
Enable admin portal when given admin=yes, default to no (TODO, not available yet)
Gracefully restart OPQ
kill -1 %{PID}
Usage
- Push Messageurl: http://%{SERVER_NAME}[:%{SERVER_PORT}]/opq/pushpost fields:1.url: target url2.topic: each message should belong to a topic3.message: message contentheader: specify the header if you needexample:(PHP)
'http://127.0.0.1/Comment/addComment?comment=nny&user=q18', 'topic'=> 'comment', 'message'=> 'this is message body', ); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $response = curl_exec($ch); var_dump($response); curl_close($ch);
- Replay Messageurl: http://%{SERVER_NAME}[:%{SERVER_PORT}]/opq/replaypost fields:1.topic: topic name2.cmd: commond number (message index, start from 0)example:(PHP)
'comment', 'cmd'=> '30', ); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $response = curl_exec($ch); var_dump($response); curl_close($ch);