Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
A really simple message queue based on Redis
This is still an alpha version. Use with care.
Lightweight: Just Redis. Every client can send and receive messages via a shared Redis server.
Guaranteed delivery of a message to exactly one recipient within a messages visibility timeout.
No security: Like memcached. Only for internal use in trusted environments.
Similar to Amazon SQS (Simple Queue Service) - with some differences:
sendMessage
method.Optional RESTful interface via rest-rsmq
id
that you can use to delete the message.sendMessage
method will return the id
for a sent message.receiveMessage
method will return an id
along with the message and some stats.createQueue
and receiveMessage
methods described below for optional parameters like visibility timeout and delay.npm install rsmq
RedisSMQ = require("rsmq");
// Initialize RedisSMQ(redisport, redishost, namespaceprefix)
rsmq = new RedisSMQ(6379,"127.0.0.1","rsmq");
Please look at the Methods section for optional parameters when creating a queue.
rsmq.createQueue({qname:"myqueue"}, function (err, resp) {
if (resp===1) {
console.log("queue created")
}
});
rsmq.sendMessage({qname:"myqueue", message:"Hello World"}, function (err, resp) {
if (resp) {
console.log("Message sent. ID:", resp);
}
});
rsmq.receiveMessage({qname:"myqueue"}, function (err, resp) {
if (resp.id) {
console.log("Message received.", resp)
}
else {
console.log("No messages for me...")
}
});
rsmq.deleteMessage({qname:"myqueue", id:"dhoiwpiirm15ce77305a5c3a3b0f230c6e20f09b55"}, function (err, resp) {
if (resp===1) {
console.log("Message deleted.")
}
else {
console.log("Message not found.")
}
});
Change the visibility timer of a single message.
The time when the message will be visible again is calculated from the current time (now) + vt
.
Parameters:
qname
(String): The Queue name.id
(String): The message id.vt
(Number): The length of time, in seconds, that this message will not be visible. Allowed values: 0-9999999 (around 115 days)Returns:
1
if successful, 0
if the message was not found.Errors:
"Queue not found"
Create a new queue.
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 (around 115 days)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 (around 115 days)maxsize
(Number): optional (Default: 65536) The maximum message size in bytes. Allowed values: 1024-65536Returns:
1
Errors:
"Invalid qname format"
"Queue exists"
Parameters:
qname
(String): The Queue name.id
(String): message id to delete.Returns:
1
if successful, 0
if the message was not found.Errors:
"Queue not found"
Deletes a queue and all messages.
Parameters:
QueueName
(String): The Queue name.Returns:
1
Errors:
"Invalid qname format"
"Queue not found"
Get queue attributes, counter and stats
Parameters:
QueueName
(String): The Queue name.Returns:
vt
: The visibility timeout for the queue in secondsdelay
: The delay for new messages in secondsmaxsize
: The maximum size of a message in bytestotalrecv
: Total number of messages received from the queuetotalsent
: Total number of messages sent to the queuecreated
: Timestamp (epoch in seconds) when the queue was createdmodified
: Timestamp (epoch in seconds) when the queue was last modified with setQueueAttributes
msgs
: Current number of messages in the queuehiddenmsgs
: Current number of hidden / not visible messages. A message can hidden while "in flight" due to a vt
parameter or when sent with a delay
.List all queues
Returns:
Receive the next message from the queue.
Parameters:
qname
(String): The Queue name.vt
(Number): optional (Default: queue settings) The length of time, in seconds, that the received message will be invisible to others. Allowed values: 0-9999999 (around 115 days)Returns:
message
: The message's contents.id
: The internal message id.sent
: Timestamp of when this message was sent / created.fr
: Timestamp of when this message was first received.rc
: Number of times this message was received.Note: Will return an empty object if no message is there
Errors:
"Queue not found"
Sends a new message.
Parameters:
qname
(String)message
(String)delay
(Number): optional (Default: queue settings) The time in seconds that the delivery of the message will be delayed. Allowed values: 0-9999999 (around 115 days)Returns:
id
: The internal message id.Error:
"Queue not found"
Sets queue parameters.
Copyright © 2013 Patrick Liess, http://www.tcs.de
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
A really simple message queue based on Redis
The npm package rsmq receives a total of 21,069 weekly downloads. As such, rsmq popularity was classified as popular.
We found that rsmq demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.