OPQ-Open Source Persistent Message Queuing

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

OPQ

    • An Open sourced persistent message Queue

    • Code is tested under go1.4.2, higher version should be OK (CAUTION:OPQ hasn ' t been tested in production environment so far)

Features

    1. Persistent message storage

    2. push Model-push message to target service and block when failure

    3. Easy-to-use-simple API whith HTTP POST method, no addtional client integration is required

    4. Message Replay

    5. High performance aimed

    6. operations-friendly -Graceful Stop/restart, HA (TODO)

Performance

    1. Over 20,000(Message/second) with 2K(Byte) Message payload

    2. 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'll enable
Log/output in debug level, default to No

-port

Listening port, default to 8999

-syslog

System log name, default to System.log

-admin

Enable Admin Portal When given admin=yes, default to No (TODO, not
Available yet)

Gracefully Restart OPQ

kill -1 %{PID}

Usage

Push Message

URL:
Http://%{server_name}[:%{server_port}]/opq/push

postfields:

  1. URL: Target URL

  2. Topic: Each message should belong to a topic

  3. message: Message content

Header: Specify the header if you need

Example: (PHP)

<?php  $url = "http://localhost:8999/opq/push";    $ch = curl_init();  curl_setopt($ch, CURLOPT_URL, $url);  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  curl_setopt($ch, CURLOPT_POST, 1);  $data = array(      'url' => '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 Message

URL:
Http://%{server_name}[:%{server_port}]/opq/replay

postfields:

  1. topic: Topic name

  2. cmd: Commond number (message index, start from 0)

Example: (PHP)

  <?php $url = "Http://localhost:8999/opq/replay";  $ch = Curl_init ();  curl_setopt ($ch, Curlopt_url, $url);   curl_setopt ($ch, Curlopt_returntransfer, 1);     curl_setopt ($ch, Curlopt_post, 1);    $data = Array (' topic ' = ' comment ', ' cmd ' = ' 30 ',);  curl_setopt ($ch, Curlopt_postfields, $data);  $response = curl_exec ($ch);  Var_dump ($response); Curl_close ($ch);  
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.