Git Product home page Git Product logo

rest-rsmq's Introduction

REST rsmq

Build Status

A REST interface for rsmq the really simple message queue based on Redis.

This REST interface makes it easy to use rsmq with other application platforms like php, .net etc. Simply call the RESTful methods to send and receive messages.

Note: There is no security built in - so use this only in a trusted enviroment, just like memcached.

Installation

  • Make sure Node 0.8.10+ is installed
  • Clone this repository
  • Run npm install to install the dependencies
  • For the test make sure Redis runs locally and run npm test
  • Optional: Modify the server port in server.js
  • Start the server: node server.js

Methods

changeMessageVisibility

PUT /message/qname/id

Change the visibility of the message with id id from queue qname.

Example:

PUT /message/myqueue/dhxekddac921a9422ec10e5439b55aa62e4dd49142?vt=5

Response:

{"result": 1}

createQueue

POST /queues/qname

Create a new queue qname

Parameters:

  • qname (String): The Queue name. Maximum 80 characters; alphanumeric characters, hyphens (-), and underscores (_) are allowed.
  • vt (Number): optional (Default: 30) The length of time, in seconds, that a message received from a queue will be invisible to other receiving components when they ask to receive messages. Allowed values: 0-9999999
  • delay (Number): optional (Default: 0) The time in seconds that the delivery of all new messages in the queue will be delayed. Allowed values: 0-9999999
  • maxsize (Number): optional (Default: 65536) The maximum message size in bytes. Allowed values: 1024-65536

Example:

POST /queues/myqueue
Content-Type: application/json

{
	"vt": 30,
	"delay": 0,
	"maxsize": 2048
}

Response:

{"result": 1}

deleteMessage

DELETE /messages/qname/id

Delete the message with id id from queue qname.

Example:

DELETE /messages/myqueue/dhxekddac921a9422ec10e5439b55aa62e4dd49142

Response:

{"result": 1}

deleteQueue

DELETE /queues/qname

Delete the queue qname and all messages in that queue.

Example:

DELETE /queues/myqueue

Response:

{"result": 1}

getQueueAttributes

Get queue attributes, counter and stats

Parameters:

  • qname (String): The Queue name.

Example:

GET /queues/myqueue

Response:

{
    "vt": 30,
    "delay": 0,
    "maxsize": 65536,
    "totalrecv": 32,
    "totalsent": 13,
    "created": 1371645477,
    "modified": 1371645477,
    "msgs": 4,
    "hiddenmsgs": 2
}

listQueues

GET /queues

List all queues.

Example:

GET /queues

Response:

{"queues": ["myqueue","someOtherQueue"]}

receiveMessage

GET /messages/qname

Receive the next message from the queue.

Parameters:

  • vt (Number): optional (Default: 30) The length of time, in seconds, that a message received from a queue will be invisible to other receiving components when they ask to receive messages. Allowed values: 0-9999999

Example:

GET /messages/myqueue?vt=30

Response:

{
    "id": "dhxeguaqv8cb2c78e9b5c97121d60f4caf54925c03",
    "message": "Hello World!",
    "rc": 1,
    "fr": 1370856862274,
    "sent": 1370855815832
}

sendMessage

POST /messages/qname

Sends a new message.

Example:

POST /messages/myqueue
Content-Type: application/json

{
	"message": "Hello World!",
	"delay": 0
}

Response:

{
    "id": "dhxekddac921a9422ec10e5439b55aa62e4dd49142"
}

The MIT License (MIT)

Please see the LICENSE.md file.

rest-rsmq's People

Contributors

smrchy avatar rsp avatar

Watchers

Howard Lince III avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.