From 4ac300e71ef758d30f24810205732fd8b1d61b55 Mon Sep 17 00:00:00 2001 From: Weyoss Date: Wed, 22 Nov 2023 18:28:02 +0100 Subject: [PATCH] docs(README.md): update features description --- README.md | 29 +++++++++++++---------------- docs/configuration.md | 4 ++-- docs/esm-cjs-modules.md | 31 +++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 18 deletions(-) create mode 100644 docs/esm-cjs-modules.md diff --git a/README.md b/README.md index a18d95a2..3b37b68b 100644 --- a/README.md +++ b/README.md @@ -17,22 +17,19 @@ RedisSMQ is a Node.js library for queuing messages (aka jobs) and processing the ## Features -* **[High-performance message processing](docs/performance.md)**. -* **[Multi-Queue Producers](docs/producing-messages.md) & [Multi-Queue Consumers](docs/consuming-messages.md)**: Offering flexible Producer/Consumer models, with focus on simplicity and without tons of features. This can make RedisSMQ an ideal message broker for your microservices. -* **[at-least-once/at-most-once Delivery](docs/api/classes/Message.md#setretrythreshold)**: In case of failures, while delivering or processing a message, RedisSMQ can guaranty that the message will be not lost and redelivered again. When configured to do so, RedisSMQ can also ensure that the message is delivered at-most-once. -* **[Different Exchange Types](docs/message-exchanges.md)**: RedisSMQ offers 3 types of exchanges: [Direct Exchange](docs/message-exchanges.md#direct-exchange), [Topic Exchange](docs/message-exchanges.md#topic-exchange), and [FanOut Exchange](docs/message-exchanges.md#fanout-exchange) for publishing a message to one or multiple queues. -* **[FIFO queues, LIFO queues, and Reliable Priority Queues](docs/queues.md)**: Provides different queuing strategies that you may use depending on your needs and requirements. -* **[Message Expiration](docs/api/classes/Message.md#setttl)**: Allowing a message to expire if it has not been delivered within a given amount of time. -* **[Message Consumption Timeout](docs/api/classes/Message.md#setconsumetimeout)**: Allowing to set up a timeout for consuming messages. -* **[Queue Rate Limiting](docs/queue-rate-limiting.md)**: Allowing to control the rate at which the messages are consumed from a given queue. -* **[Scheduling Messages](docs/scheduling-messages.md)**: Messages can be configured to be delayed, delivered for N times with an optional period between deliveries, and to be scheduled using CRON expressions. -* **[Multiplexing](/docs/multiplexing.md)**: A feature which allows message handlers to use a single redis connection to dequeue and consume messages. -* **[HTTP API](https://github.com/weyoss/redis-smq-monitor)**: an HTTP interface is provided to interact with the MQ. -* **[Web UI](https://github.com/weyoss/redis-smq-monitor-client)**: RedisSMQ can be managed also from your web browser. -* **[Logging](https://github.com/weyoss/redis-smq-common/blob/master/docs/logs.md)**: RedisSMQ comes with a built-in JSON logger, but can also use your application logger. -* **[Configurable](docs/configuration.md)**: Many options and features can be configured. -* **[Multiple Redis clients](docs/configuration.md)**: Depending on your preferences, RedisSMQ can use either [node-redis v3](https://github.com/redis/node-redis/tree/v3.1.2), [node-redis v4](https://github.com/redis/node-redis), or [ioredis](https://github.com/luin/ioredis). -* **[Highly optimized](https://lgtm.com/projects/g/weyoss/redis-smq/context:javascript)**: Strongly-typed and implemented using pure callbacks, with small memory footprint and no memory leaks. See [Callback vs Promise vs Async/Await benchmarks](https://gist.github.com/weyoss/24f9ecbda175d943a48cb7ec38bde821). +* [High-performance message processing](docs/performance.md). +* Flexible Producer/Consumer model which offers [Multi-Queue Producers](docs/producing-messages.md) & [Multi-Queue Consumers](docs/consuming-messages.md), focuses on simplicity and without tons of features. This makes RedisSMQ an ideal message broker for microservices-based applications. +* In case of failures, while delivering or processing a message, RedisSMQ can guaranty that the message is not lost and that it is redelivered [at-least-once](docs/api/classes/Message.md#setretrythreshold). When configured to do so, RedisSMQ can also ensure that the message is delivered [at-most-once](docs/api/classes/Message.md#setretrythreshold). +* RedisSMQ offers different exchange types: [Direct Exchange](docs/message-exchanges.md#direct-exchange), [Topic Exchange](docs/message-exchanges.md#topic-exchange), and [FanOut Exchange](docs/message-exchanges.md#fanout-exchange) for publishing a message to one or multiple queues. +* 3 queuing strategies that you may use depending on your needs and requirements: [FIFO queues, LIFO queues, and Reliable Priority Queues](docs/queues.md). +* A message can be [set to expire](docs/api/classes/Message.md#setttl) if it has not been delivered within a given amount of time. [Consumption timeout](docs/api/classes/Message.md#setconsumetimeout) allows canceling a message consumption if a consumer did not acknowledge the message for a period of time. +* [Queue Rate Limiting](docs/queue-rate-limiting.md) which allows to control the rate at which the messages are consumed from a given queue. +* Builtin [message scheduler](docs/scheduling-messages.md) allowing to delay a message, to deliver a message for N times with an optional period between deliveries, or simply to schedule message delivery using CRON expressions. +* [Multiplexing](/docs/multiplexing.md): A feature which allows message handlers to use a single redis connection to dequeue and consume messages. +* An [HTTP interface](https://github.com/weyoss/redis-smq-monitor) is provided to interact with the MQ. RedisSMQ can be managed also from your [web browser](https://github.com/weyoss/redis-smq-monitor-client). +* Depending on [your preferences](docs/configuration.md), RedisSMQ can use either [node-redis v3](https://github.com/redis/node-redis/tree/v3.1.2), [node-redis v4](https://github.com/redis/node-redis), or [ioredis](https://github.com/luin/ioredis). +* RedisSMQ is [highly optimized](https://lgtm.com/projects/g/weyoss/redis-smq/context:javascript), implemented using pure callbacks, with small memory footprint and no memory leaks. See [Callback vs Promise vs Async/Await benchmarks](https://gist.github.com/weyoss/24f9ecbda175d943a48cb7ec38bde821). +* [Both ESM & CJS modules are supported](docs/esm-cjs-modules.md). ## RedisSMQ Use Case: Multi-Queue Producers & Multi-Queue Consumers diff --git a/docs/configuration.md b/docs/configuration.md index 3fbb2c84..9420179c 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -67,11 +67,11 @@ module.exports = { #### Message Storage -Published messages, to a queue, are permanently stored unless deleted explicitly. +Published messages, to a queue, are permanently stored unless deleted explicitly. The `message.store` option allows, additionally, to configure acknowledged/dead-lettered messages storage for all message queues. -In other words, when `message.store` is enabled, a queue, in addition to all published messages, may hold a list of all +In other words, when `message.store` is enabled, a queue, in addition to all published messages, may hold a list of all dead-lettered messages for example. By default acknowledged and dead-lettered messages are not stored. diff --git a/docs/esm-cjs-modules.md b/docs/esm-cjs-modules.md new file mode 100644 index 00000000..d86bb74d --- /dev/null +++ b/docs/esm-cjs-modules.md @@ -0,0 +1,31 @@ +> [RedisSMQ](../README.md) / [Docs](README.md) / ESM & CJS Modules + +# ESM & CJS Modules + +Nowadays, ES modules (ESM) are the official standard packaging format for both backend and frontend JavaScript +applications. Nevertheless, CommonJS modules (CJS) are still very popular and used by many NPM packages. + +Official RedisSMQ packages are distributed in both ESM & CJS formats to allow developers to choose the right module +system depending on their applications. + +## Using RedisSMQ as an ESM Module + +```javascript +import { Queue, EQueueType } from 'redis-smq'; + +const queue = new Queue(); + +// Creating a LIFO queue +queue.save('my_queue', EQueueType.LIFO_QUEUE, (err) => console.log(err)); +``` + +## Using RedisSMQ as an CJS Module + +```javascript +const { Queue, EQueueType } = require('redis-smq'); + +const queue = new Queue(); + +// Creating a LIFO queue +queue.save('my_queue', EQueueType.LIFO_QUEUE, (err) => console.log(err)); +```