redis-smq 8.0.0-rc.14 → 8.0.0-rc.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,54 @@
1
1
 
2
2
 
3
+ ## [8.0.0-rc.16](https://github.com/weyoss/redis-smq/compare/v8.0.0-rc.15...v8.0.0-rc.16) (2024-01-28)
4
+
5
+
6
+ ### Features
7
+
8
+ * allow running/sandboxing message handlers using worker threads ([53095bd](https://github.com/weyoss/redis-smq/commit/53095bd2689ccb2f701365bafb4ef8e550da82b3))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * export message handler errors ([26d2689](https://github.com/weyoss/redis-smq/commit/26d26890da139d88c46ce220e3dda3d9c8e03aee))
14
+
15
+
16
+ ### Documentation
17
+
18
+ * **ConsumeMessageWorker:** update docs and clean up ([140322e](https://github.com/weyoss/redis-smq/commit/140322e3520ee3db905ea977a159064f339aa7d2))
19
+ * fix broken links ([aad9010](https://github.com/weyoss/redis-smq/commit/aad9010e70ed332b154f4fbdcb8ac657a14fe6b9))
20
+ * update messages and queues documentation ([7c3d06e](https://github.com/weyoss/redis-smq/commit/7c3d06ed3765ffc14dfece4f725241aa4535e1e7))
21
+
22
+
23
+ ### Codebase Refactoring
24
+
25
+ * **ConsumeMessageWorker:** improve typings ([66c6ca9](https://github.com/weyoss/redis-smq/commit/66c6ca948677f76d496fe0b988bd195e1a7108a2))
26
+
27
+
28
+ ### Tests
29
+
30
+ * allow running/sandboxing message handlers using worker threads ([79e6886](https://github.com/weyoss/redis-smq/commit/79e688674ed11ec34ce2f74d5f15c8eefa129767))
31
+
32
+ ## [8.0.0-rc.15](https://github.com/weyoss/redis-smq/compare/v8.0.0-rc.14...v8.0.0-rc.15) (2024-01-25)
33
+
34
+
35
+ ### Features
36
+
37
+ * add Pub/Sub delivery model, refactor and clean up ([47affa1](https://github.com/weyoss/redis-smq/commit/47affa172eb2fc6943f660bea3feab3af1bc28ec))
38
+
39
+
40
+ ### Documentation
41
+
42
+ * add a notification about the latest release, clean up ([904f196](https://github.com/weyoss/redis-smq/commit/904f196f1854059625b08af05fe5ceb1466d4a9f))
43
+ * add Pub/Sub delivery model, refactor and clean up ([32db9dd](https://github.com/weyoss/redis-smq/commit/32db9dd2772bc16568e03e6e216a7d0fd0a599a7))
44
+ * clean up ([c7d13a6](https://github.com/weyoss/redis-smq/commit/c7d13a639a1ed9f134ba3deb99d1e2a23223935a))
45
+
46
+
47
+ ### Misc
48
+
49
+ * bump up redis-smq-common to v3.0.0-rc.8 ([d411849](https://github.com/weyoss/redis-smq/commit/d4118496263479036085ee09ceb5785ee497bb59))
50
+ * bump up redis-smq-common to v3.0.0-rc9 ([d372e9d](https://github.com/weyoss/redis-smq/commit/d372e9d98593934e9e9fb63efcd56cbad99202af))
51
+
3
52
  ## [8.0.0-rc.14](https://github.com/weyoss/redis-smq/compare/v8.0.0-rc.13...v8.0.0-rc.14) (2024-01-03)
4
53
 
5
54
 
package/README.md CHANGED
@@ -1,6 +1,10 @@
1
+ > [!IMPORTANT]
2
+ > Currently, RedisSMQ is going under heavy development. Pre-releases at any time may introduce new commits with breaking changes.
3
+ > The master branch always reflects the most recent changes. To view the latest release reference see [RedisSMQ v7.2.3](https://github.com/weyoss/redis-smq/tree/v7.2.3)
4
+
1
5
  <div align="center" style="text-align: center">
2
6
  <p><a href="https://github.com/weyoss/redis-smq"><img alt="RedisSMQ" src="./logo.png?v=202312182134" /></a></p>
3
- <p style='color: #d82c20'>A simple high-performance Redis message queue for Node.js.</p>
7
+ <p>A simple high-performance Redis message queue for Node.js.</p>
4
8
  </div>
5
9
 
6
10
  # RedisSMQ
@@ -13,28 +17,28 @@
13
17
  <a href="https://npmjs.org/package/redis-smq" rel="nofollow"><img src="https://img.shields.io/npm/dm/redis-smq.svg" alt="NPM downloads" /></a>
14
18
  </p>
15
19
 
16
- RedisSMQ is a Node.js library for queuing messages (aka jobs) and processing them asynchronously with consumers. Backed by Redis, it allows scaling up your application with ease of use.
20
+ RedisSMQ is a Node.js library for queuing messages (aka jobs) and processing them asynchronously with consumers. Backed by Redis, it allows scaling up your typical applications with ease of use.
17
21
 
18
22
  ## Features
19
23
 
20
24
  * [High-performance message processing](docs/performance.md).
21
- * 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.
22
- * 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/ProducibleMessage.md#setretrythreshold). When configured to do so, RedisSMQ can also ensure that the message is delivered [at-most-once](docs/api/classes/ProducibleMessage.md#setretrythreshold).
25
+ * Flexible Producer/Consumer model which offers [Multi-Queue Producers](docs/producing-messages.md) & [Multi-Queue Consumers](docs/consuming-messages.md).
23
26
  * 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.
24
- * 3 queuing strategies that you may use depending on your needs and requirements: [FIFO queues, LIFO queues, and Reliable Priority Queues](docs/queues.md).
25
- * A message can be [set to expire](docs/api/classes/ProducibleMessage.md#setttl) if it has not been delivered within a given amount of time. [Consumption timeout](docs/api/classes/ProducibleMessage.md#setconsumetimeout) allows canceling a message consumption if a consumer did not acknowledge the message for a period of time.
26
- * [Queue Rate Limiting](docs/queue-rate-limiting.md) which allows to control the rate at which the messages are consumed from a given queue.
27
- * 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.
28
- * [Multiplexing](/docs/multiplexing.md): A feature which allows message handlers to use a single redis connection to dequeue and consume messages.
29
- * 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).
30
- * 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).
31
- * 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).
27
+ * Supports [Point-2-Point](docs/queue-delivery-models.md#point-2-point-delivery-model) and [Pub/Sub](docs/queue-delivery-models.md#pubsub-delivery-model) [delivery models](docs/queue-delivery-models.md).
28
+ * Both [delivery models](docs/queue-delivery-models.md) are reliable. For cases of failure, while delivering/consuming messages, [at-least-once](docs/api/classes/ProducibleMessage.md#setretrythreshold) and [at-most-once](docs/api/classes/ProducibleMessage.md#setretrythreshold) modes may be configured.
29
+ * [3 queuing strategies](docs/queues.md): [FIFO queues](docs/queues.md#fifo-first-in-first-out-queues), [LIFO queues](docs/queues.md#lifo-last-in-first-out-queues), and [Priority Queues](docs/queues.md#priority-queues).
30
+ * [Message Handler Worker Threads](docs/message-handler-worker-threads.md) which allow sandboxing and running your message handler from a separate isolated thread and without affecting the performance of other message handlers from the same consumer.
31
+ * Messages can be [set to expire](docs/api/classes/ProducibleMessage.md#setttl) when not delivered within a given amount of time or to have a [consumption timeout](docs/api/classes/ProducibleMessage.md#setconsumetimeout) while being in process.
32
+ * Queues may be [rate Limited](docs/queue-rate-limiting.md) to control the rate at which the messages are consumed.
33
+ * Has a builtin [scheduler](docs/scheduling-messages.md) allowing messages [to be delayed](docs/api/classes/ProducibleMessage.md#setscheduleddelay), [to be delivered for N times](docs/api/classes/ProducibleMessage.md#setscheduledrepeat) with an optional [period between deliveries](docs/api/classes/ProducibleMessage.md#setscheduledrepeatperiod), or simply [to be scheduled using CRON expressions](docs/api/classes/ProducibleMessage.md#setscheduledcron).
34
+ * Provides [an HTTP API](https://github.com/weyoss/redis-smq-monitor) to interact with the message queue for external services.
35
+ * RedisSMQ can be managed also from your [web browser](https://github.com/weyoss/redis-smq-monitor-client).
36
+ * Either [node-redis](https://github.com/redis/node-redis) or [ioredis](https://github.com/luin/ioredis) can be used as a Redis client.
37
+ * [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).
32
38
  * [Both ESM & CJS modules are supported](docs/esm-cjs-modules.md).
33
39
 
34
40
  ## RedisSMQ Use Case: Multi-Queue Producers & Multi-Queue Consumers
35
41
 
36
- &nbsp;
37
-
38
42
  ![RedisSMQ Multi-Queue Producers & Multi-Queue Consumers](docs/redis-smq-multi-queue-consumers-producers.png)
39
43
 
40
44
  ## What's new?
@@ -43,8 +47,6 @@ RedisSMQ is a Node.js library for queuing messages (aka jobs) and processing the
43
47
 
44
48
  ## Installation
45
49
 
46
- > Currently, RedisSMQ is going under heavy development. Pre-releases at any time may introduce new commits with breaking changes. To view the latest release reference see [RedisSMQ v7.2.3](https://github.com/weyoss/redis-smq/tree/v7.2.3)
47
-
48
50
  ```shell
49
51
  npm i redis-smq@rc
50
52
  ```
@@ -65,40 +67,44 @@ A queue is responsible for holding messages which are produced by producers and
65
67
  ### Creating a queue
66
68
 
67
69
  ```javascript
68
- const { Queue, EQueueType } = require('redis-smq');
69
-
70
70
  const queue = new Queue();
71
-
72
- // Creating a LIFO queue
73
- queue.save('my_queue', EQueueType.LIFO_QUEUE, (err) => console.log(err));
71
+ queue.save('my_queue', EQueueType.LIFO_QUEUE, EQueueDeliveryModel.POINT_TO_POINT, (err) => {
72
+ if (err) console.error(err)
73
+ });
74
74
  ```
75
75
 
76
- ### Producing a message
76
+ In the example above we are defining a [LIFO queue](docs/queues.md#lifo-last-in-first-out-queues) with a [POINT-2-POINT delivery model](docs/queue-delivery-models.md#point-2-point-delivery-model).
77
77
 
78
- ```javascript
79
- const { Producer, ProducibleMessage } = require('redis-smq');
78
+ See [Queues](docs/queues.md) for more details.
80
79
 
81
- const producer = new Producer();
80
+ ### Producing a message
82
81
 
82
+ ```javascript
83
83
  const msg = new ProducibleMessage();
84
84
  msg.setQueue('my_queue').setBody('Hello Word!')
85
-
86
- producer.produce(msg, (err) => console.log(err));
85
+ producer.produce(msg, (err, ids) => {
86
+ if (err) console.error(err);
87
+ else console.log(`Produced message IDs are: ${ids.join(', ')}`)
88
+ });
87
89
  ```
88
90
 
91
+ See [Producing Messages](docs/producing-messages.md) for more details.
92
+
89
93
  ### Consuming a message
90
94
 
91
95
  ```javascript
92
- const { Consumer } = require('redis-smq');
93
-
94
96
  const consumer = new Consumer();
95
97
  const messageHandler = (msg, cb) => {
96
- console.log(msg.getBody());
98
+ console.log(msg.body);
97
99
  cb();
98
100
  }
99
- consumer.consume('my_queue', messageHandler, (err) => console.log(err));
101
+ consumer.consume('my_queue', messageHandler, (err) => {
102
+ if (err) console.error(err);
103
+ });
100
104
  ```
101
105
 
106
+ See [Consuming Messages](docs/consuming-messages.md) for more details.
107
+
102
108
  ## Documentation
103
109
 
104
110
  See [RedisSMQ Docs](docs/README.md) for more details.