Skip to content

Commit

Permalink
docs: add new diagrams and update existing ones
Browse files Browse the repository at this point in the history
  • Loading branch information
weyoss committed Jan 3, 2024
1 parent ecf301b commit f5182b1
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
@@ -1,6 +1,6 @@
<div align="center" style="text-align: center">
<p><a href="https://github.com/weyoss/redis-smq"><img alt="RedisSMQ" src="./logo.png?v=202312182134" /></a></p>
<p>A simple high-performance Redis message queue for Node.js.</p>
<p style='color: #d82c20'>A simple high-performance Redis message queue for Node.js.</p>
</div>

# RedisSMQ
Expand Down Expand Up @@ -35,7 +35,7 @@ RedisSMQ is a Node.js library for queuing messages (aka jobs) and processing the

&nbsp;

![RedisSMQ Overview](docs/redis-smq-overview.png)
![RedisSMQ Multi-Queue Producers & Multi-Queue Consumers](docs/redis-smq-multi-queue-consumers-producers.png)

## What's new?

Expand Down
12 changes: 12 additions & 0 deletions docs/message-exchanges.md
Expand Up @@ -22,6 +22,10 @@ Out-of-box RedisSMQ offers 3 exchange types.

## Direct Exchange

&nbsp;

![RedisSMQ Direct Exchange](redis-smq-direct-exchange.png)

A direct exchange allows producers to publish a message to a single queue which is matched exactly by the specified queue of the exchange.

The queue of the direct exchange may be a string, like `a.b.c.d` or an object describing the namespace of the queue like `{ ns: 'my-app', name: 'a.b.c.d'}`.
Expand Down Expand Up @@ -52,6 +56,10 @@ When publishing a message with a direct exchange, if the exchange queue does not

## Topic Exchange

&nbsp;

![RedisSMQ Topic Exchange](redis-smq-topic-exchange.png)

When a topic exchange is used for a message, it allows to publish the message to one or multiple queues which are matched by the topic pattern of the exchange.

The pattern of a topic exchange is a string which is composed of alphanumeric characters, including `-` and `_` characters, that are separated by a `.`.
Expand Down Expand Up @@ -86,6 +94,10 @@ When publishing a message with a topic exchange, if the topic pattern does not m

## FanOut Exchange

&nbsp;

![RedisSMQ FanOut Exchange](redis-smq-fanout-exchange.png)

A FanOut exchange allows producers to publish a message to one or multiple queues which are bound to this exchange by a binding key.

### Usage
Expand Down
16 changes: 14 additions & 2 deletions docs/queues.md
Expand Up @@ -6,12 +6,16 @@ A queue is responsible for holding messages which are produced by producers and

RedisSMQ supports 3 types of queues: **LIFO queues**, **FIFO queues**, and **Priority queues**.

All RedisSMQ queue types are **reliable**. A queue is said to be reliable, when during a failure scenario, let it be for example a consumer crash, it can recover from such failure and the message being processed is not lost.
All RedisSMQ queue types are **reliable**. A queue is said to be reliable, when during a failure scenario, let it be for example a consumer crash, it can recover from such failure and the message being processed is not lost.

In a typical use case, both LIFO and FIFO queues use [brpoplpush](https://redis.io/commands/brpoplpush), which blocks the connection to the Redis server until a message is received. However, priority queues use pooling and lua scripting which introduce a little of overhead on the MQ and therefore priority queues are less performant than other queue types.

## LIFO (Last In, First Out) queues

&nbsp;

![RedisSMQ LIFO Queuing](redis-smq-lifo.png)

In a LIFO queue the last published messages are always delivered first and the first published messages are delivered last.

```javascript
Expand All @@ -27,6 +31,10 @@ See [Queue.prototype.save()](api/classes/Queue.md#save) for more details.

## FIFO (First In, First Out) Queues

&nbsp;

![RedisSMQ FIFO Queuing](redis-smq-fifo.png)

In a FIFO queue the first published messages are delivered first and the last published messages are delivered last.

```javascript
Expand All @@ -42,6 +50,10 @@ See [Queue.prototype.save()](api/classes/Queue.md#save) for more details.

## Priority Queues

&nbsp;

![RedisSMQ Priority Queuing](redis-smq-priority-queuing.png)

In a priority queue, messages with higher priority are always delivered first before messages with lower priority.

```javascript
Expand Down Expand Up @@ -77,7 +89,7 @@ See [EMessagePriority](api/enums/EMessagePriority.md).

## Queue Namespaces

Queues in RedisSMQ are namespaced.
Queues in RedisSMQ are namespaced.

A queue namespace is used as a scope for a given set of queues to ensure unique queue names and to avoid **name collisions** when multiple queues share the same name.

Expand Down
Binary file added docs/redis-smq-direct-exchange.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/redis-smq-fanout-exchange.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/redis-smq-fifo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/redis-smq-lifo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/redis-smq-overview.png
Binary file not shown.
Binary file added docs/redis-smq-priority-queuing.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/redis-smq-topic-exchange.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f5182b1

Please sign in to comment.