From 0299b314e843c28d52e2f767ace150e39652287c Mon Sep 17 00:00:00 2001 From: Weyoss Date: Sun, 28 Jan 2024 20:09:48 +0100 Subject: [PATCH] docs: simplify and unify class/method naming and referencing --- docs/consuming-messages.md | 8 ++--- docs/message-exchanges.md | 28 ++++++++--------- docs/message-handler-worker-threads.md | 2 +- docs/messages.md | 10 +++--- docs/multiplexing.md | 2 +- docs/producing-messages.md | 2 +- docs/queue-delivery-models.md | 10 +++--- docs/queue-rate-limiting.md | 8 ++--- docs/queues.md | 42 ++++++++++++++------------ docs/scheduling-messages.md | 10 +++--- 10 files changed, 62 insertions(+), 60 deletions(-) diff --git a/docs/consuming-messages.md b/docs/consuming-messages.md index ff08f9ba..b0388dc6 100644 --- a/docs/consuming-messages.md +++ b/docs/consuming-messages.md @@ -5,17 +5,17 @@ A `Consumer` instance can be used to receive and consume messages from one or multiple queues. To consume messages from a queue, the [Consumer Class](api/classes/Consumer.md) class provides the -[consume()](api/classes/Consumer.md#consume) method which allows to register a `message handler`. +[Consumer.consume()](api/classes/Consumer.md#consume) method which allows to register a `message handler`. A `message handler` is a function that receives a delivered message from a given queue. Message handlers can be registered at any time, before or after a consumer has been started. -In contrast to producers, consumers are not automatically started upon creation. To start a consumer use the [run()](api/classes/Consumer.md#run) method. +In contrast to producers, consumers are not automatically started upon creation. To start a consumer use the [Consumer.run()](api/classes/Consumer.md#run) method. -To stop consuming messages from a queue and to remove the associated `message handler` from your consumer, use the [cancel()](api/classes/Consumer.md#cancel) method. +To stop consuming messages from a queue and to remove the associated `message handler` from your consumer, use the [Consumer.cancel()](api/classes/Consumer.md#cancel) method. -To shut down completely your consumer and tear down all message handlers, use the [shutdown()](api/classes/Consumer.md#shutdown) method. +To shut down completely your consumer and tear down all message handlers, use the [Consumer.shutdown()](api/classes/Consumer.md#shutdown) method. ```javascript 'use strict'; diff --git a/docs/message-exchanges.md b/docs/message-exchanges.md index 59682389..bd5cdc3c 100644 --- a/docs/message-exchanges.md +++ b/docs/message-exchanges.md @@ -36,11 +36,11 @@ A direct exchange with the queue `a.b.c.d` matches exactly the queue with the na The [ProducibleMessage Class](api/classes/ProducibleMessage.md) provides: -- [setQueue()](api/classes/ProducibleMessage.md#setqueue): to set up a queue for the message. Under the hood, a new `ExchangeDirect` instance will be created and used for the message exchange. -- [setExchange()](api/classes/ProducibleMessage.md#setexchange): to set a `ExchangeDirect` instance which you have manually created. +- [ProducibleMessage.setQueue()](api/classes/ProducibleMessage.md#setqueue): to set up a queue for the message. Under the hood, a new `ExchangeDirect` instance will be created and used for the message exchange. +- [ProducibleMessage.setExchange()](api/classes/ProducibleMessage.md#setexchange): to set a `ExchangeDirect` instance which you have manually created. ```typescript -import { ProducibleMessage, ExchangeDirect } from "redis-smq"; +const { ProducibleMessage, ExchangeDirect } = require("redis-smq"); const msg = new ProducibleMessage(); msg.setQueue('a.b.c.d').setBody('123456789'); @@ -72,11 +72,11 @@ When a namespace is not provided the default namespace will be used. The [ProducibleMessage Class](api/classes/ProducibleMessage.md) provides: -- [setTopic()](api/classes/ProducibleMessage.md#settopic): to set up a topic for the message. Under the hood, a new `ExchangeTopic` instance will be created and used for the message exchange. -- [setExchange()](api/classes/ProducibleMessage.md#setexchange): to set a `ExchangeTopic` instance which you have manually created. +- [ProducibleMessage.setTopic()](api/classes/ProducibleMessage.md#settopic): to set up a topic for the message. Under the hood, a new `ExchangeTopic` instance will be created and used for the message exchange. +- [ProducibleMessage.setExchange()](api/classes/ProducibleMessage.md#setexchange): to set a `ExchangeTopic` instance which you have manually created. ```typescript -import { ProducibleMessage, ExchangeTopic } from "redis-smq"; +const { ProducibleMessage, ExchangeTopic } = require("redis-smq"); const msg = new ProducibleMessage(); msg.setTopic('a.b.c.d').setBody('123456789'); @@ -98,20 +98,20 @@ A FanOut exchange allows producers to publish a message to one or multiple queue In order to use a FanOut exchange you need first to create it and bind the selected queues to the exchange. -The [FanOutExchange](api/classes/ExchangeFanOut.md) provides: +The [ExchangeFanOut Class](api/classes/ExchangeFanOut.md) provides: -- [bindQueue()](api/classes/ExchangeFanOut.md#bindqueue): To bind an existing queue to a FanOut exchange. -- [unbindQueue()](api/classes/ExchangeFanOut.md#unbindqueue): To unbind a queue from a FanOut exchange. -- [getQueueExchange()](api/classes/ExchangeFanOut.md#getqueueexchange): To retrieve the FanOut exchange to which a queue is bound. -- [getQueues()](api/classes/ExchangeFanOut.md#getqueues): To get the list of queues that are bound to a given FanOut exchange. +- [ExchangeFanOut.bindQueue()](api/classes/ExchangeFanOut.md#bindqueue): To bind an existing queue to a FanOut exchange. +- [ExchangeFanOut.unbindQueue()](api/classes/ExchangeFanOut.md#unbindqueue): To unbind a queue from a FanOut exchange. +- [ExchangeFanOut.getQueueExchange()](api/classes/ExchangeFanOut.md#getqueueexchange): To retrieve the FanOut exchange to which a queue is bound. +- [ExchangeFanOut.getQueues()](api/classes/ExchangeFanOut.md#getqueues): To get the list of queues that are bound to a given FanOut exchange. The [ProducibleMessage API](api/classes/ProducibleMessage.md) provides: -- [setFanOut()](api/classes/ProducibleMessage.md#setfanout): to set up a FanOut exchange for the message. Under the hood, a new `ExchangeFanOut` instance will be created and used for the message exchange. -- [setExchange()](api/classes/ProducibleMessage.md#setexchange): to set a `ExchangeFanOut` instance which you have manually created. +- [ProducibleMessage.setFanOut()](api/classes/ProducibleMessage.md#setfanout): to set up a FanOut exchange for the message. Under the hood, a new `ExchangeFanOut` instance will be created and used for the message exchange. +- [ProducibleMessage.setExchange()](api/classes/ProducibleMessage.md#setexchange): to set a `ExchangeFanOut` instance which you have manually created. ```typescript -import { ProducibleMessage, ExchangeFanOut } from "redis-smq"; +const { ProducibleMessage, ExchangeFanOut } = require("redis-smq"); // Assuming that my-FanOut-exchange already exists diff --git a/docs/message-handler-worker-threads.md b/docs/message-handler-worker-threads.md index 84391816..cad9a684 100644 --- a/docs/message-handler-worker-threads.md +++ b/docs/message-handler-worker-threads.md @@ -53,4 +53,4 @@ Please note that message handler filename should be always an absolute path. If you are using TypeScript as your primary language you should create and save as usually your message handler file with a `.ts` extension. But when registering your message handler the `.ts` extension, in the message handler filename, should be replaced with a `.js` or `.cjs` extension depending on your TypeScript project settings. -See [Consumer.prototype.consume](docs/api/classes/Consumer.md#consume) for more details. +See [Consumer.consume()](api/classes/Consumer.md#consume) for more details. diff --git a/docs/messages.md b/docs/messages.md index 99bfae40..53e62a03 100644 --- a/docs/messages.md +++ b/docs/messages.md @@ -21,8 +21,8 @@ See: - [ProducibleMessage Class](api/classes/ProducibleMessage.md) - To set up various message parameters - [Message Class](api/classes/Message.md) - To fetch/delete a message or a list of messages -- [QueueMessages](docs/api/classes/QueueMessages.md) - To browse all queue messages -- [QueuePendingMessages](docs/api/classes/QueuePendingMessages.md) - To browse queue pending messages -- [QueueAcknowledgedMessages](docs/api/classes/QueueAcknowledgedMessages.md) - To browse/requeue/delete queue acknowledged messages -- [QueueDeadLetteredMessages](docs/api/classes/QueueDeadLetteredMessages.md) - To browse/requeue/delete queue dead-lettered messages -- [QueueScheduledMessages](docs/api/classes/QueueScheduledMessages.md) - To browse/delete queue scheduled messages +- [QueueMessages Class](api/classes/QueueMessages.md) - To browse all queue messages +- [QueuePendingMessages Class](api/classes/QueuePendingMessages.md) - To browse queue pending messages +- [QueueAcknowledgedMessages Class](api/classes/QueueAcknowledgedMessages.md) - To browse/requeue/delete queue acknowledged messages +- [QueueDeadLetteredMessages Class](api/classes/QueueDeadLetteredMessages.md) - To browse/requeue/delete queue dead-lettered messages +- [QueueScheduledMessages Class](api/classes/QueueScheduledMessages.md) - To browse/delete queue scheduled messages diff --git a/docs/multiplexing.md b/docs/multiplexing.md index ebba3c69..216f7179 100644 --- a/docs/multiplexing.md +++ b/docs/multiplexing.md @@ -20,7 +20,7 @@ So, before deciding whether to use multiplexing, it is important to know what yo ## Enabling multiplexing -Use the [Consumer class constructor](api/classes/Consumer.md#constructor) first argument to enable multiplexing: +Use the [Consumer Class Constructor](api/classes/Consumer.md#constructor) first argument to enable multiplexing: ```javascript const consumer = new Consumer(true); diff --git a/docs/producing-messages.md b/docs/producing-messages.md index 9dd911e8..71a5e16a 100644 --- a/docs/producing-messages.md +++ b/docs/producing-messages.md @@ -6,7 +6,7 @@ A `Producer` instance allows to publish a message to a queue. You can use a single `Producer` instance to produce messages, including messages with priority, to one or multiple queues. -Before publishing a message do not forget to set an exchange for the message using [setQueue()](api/classes/ProducibleMessage.md#setqueue), [setTopic()](api/classes/ProducibleMessage.md#settopic), or [setFanOut()](api/classes/ProducibleMessage.md#setfanout). Otherwise, an error will be returned. +Before publishing a message do not forget to set an exchange for the message using [ProducibleMessage.setQueue()](api/classes/ProducibleMessage.md#setqueue), [setTopic()](api/classes/ProducibleMessage.md#settopic), or [setFanOut()](api/classes/ProducibleMessage.md#setfanout). Otherwise, an error will be returned. See [Message Exchanges](message-exchanges.md) for more details. diff --git a/docs/queue-delivery-models.md b/docs/queue-delivery-models.md index dcac4f22..7f95646b 100644 --- a/docs/queue-delivery-models.md +++ b/docs/queue-delivery-models.md @@ -22,7 +22,7 @@ queue.save('my-queue', EQueueType.LIFO_QUEUE, EQueueDeliveryModel.POINT_TO_POINT }) ``` -See [Queue.prototype.save()](api/classes/Queue.md#save) for more details. +See [Queue.save()](api/classes/Queue.md#save) for more details. ### Publishing a Message to a Point-2-Point Queue @@ -42,7 +42,7 @@ producer.run((err) => { }) ``` -See [Producer.prototype.produce()](api/classes/Producer.md#produce) for more details. +See [Producer.produce()](api/classes/Producer.md#produce) for more details. ### Consuming a message from a Point-2-Point Queue @@ -99,7 +99,7 @@ queue.save('my-pubsub-queue', EQueueType.LIFO_QUEUE, EQueueDeliveryModel.PUB_SUB }) ``` -See [Queue.prototype.save()](api/classes/Queue.md#save) for more details. +See [Queue.save()](api/classes/Queue.md#save) for more details. ### Creating Consumer Groups @@ -107,7 +107,7 @@ If it does not exist a consumer group of a given queue is created automatically Consumer groups may be also created manually using the [ConsumerGroups.saveConsumerGroup()](api/classes/ConsumerGroups.md) method. -See [ConsumerGroups](api/classes/ConsumerGroups.md) for managing consumer groups. +See [ConsumerGroups Class](api/classes/ConsumerGroups.md) for managing consumer groups. ### Publishing a Message to a Pub/Sub Queue @@ -131,7 +131,7 @@ When producing a message to a Pub/Sub queue, if the queue has no consumer groups So make sure the queue has at least one consumer group before publishing messages. -See [Producer.prototype.produce()](api/classes/Producer.md#produce) for more details. +See [Producer.produce()](api/classes/Producer.md#produce) for more details. ### Consuming a message from a Pub/Sub Queue diff --git a/docs/queue-rate-limiting.md b/docs/queue-rate-limiting.md index 500dc850..fc80d042 100644 --- a/docs/queue-rate-limiting.md +++ b/docs/queue-rate-limiting.md @@ -11,11 +11,11 @@ In some cases consuming messages with a high message rate may be not desirable. RedisSMQ allows you, in such cases, to control the rate at which the messages are consumed by setting a rate limit for a given queue. -To configure and view rate limiting parameters for a queue, the [QueueRateLimit](api/classes/QueueRateLimit.md) provides the following methods: +To configure and view rate limiting parameters for a queue, the [QueueRateLimit Class](api/classes/QueueRateLimit.md) provides the following methods: -- [QueueRateLimit.prototype.set()](api/classes/QueueRateLimit.md#set) -- [QueueRateLimit.prototype.clear()](api/classes/QueueRateLimit.md#clear) -- [QueueRateLimit.prototype.get()](api/classes/QueueRateLimit.md#get) +- [QueueRateLimit.set()](api/classes/QueueRateLimit.md#set) +- [QueueRateLimit.clear()](api/classes/QueueRateLimit.md#clear) +- [QueueRateLimit.get()](api/classes/QueueRateLimit.md#get) **Example** diff --git a/docs/queues.md b/docs/queues.md index b10e84a7..d5a6aef6 100644 --- a/docs/queues.md +++ b/docs/queues.md @@ -25,7 +25,7 @@ const queue = new Queue(); queue.save('my_lifo_queue', EQueueType.LIFO_QUEUE, (err) => console.error(err)); ``` -See [Queue.prototype.save()](api/classes/Queue.md#save) for more details. +See [Queue.save()](api/classes/Queue.md#save) for more details. ## FIFO (First In, First Out) Queues @@ -42,7 +42,7 @@ const queue = new Queue(); queue.save('my_fifo_queue', EQueueType.FIFO_QUEUE, (err) => console.error(err)); ``` -See [Queue.prototype.save()](api/classes/Queue.md#save) for more details. +See [Queue.save()](api/classes/Queue.md#save) for more details. ## Priority Queues @@ -59,14 +59,14 @@ const queue = new Queue(); queue.save('my_priority_queue', EQueueType.PRIORITY_QUEUE, (err) => console.error(err)); ``` -See [Queue.prototype.save()](api/classes/Queue.md#save) for more details. +See [Queue.save()](api/classes/Queue.md#save) for more details. ### Setting Up a ProducibleMessage Priority -To set up a message priority, the [ProducibleMessage API](api/classes/ProducibleMessage.md) provides the following methods: +To set up a message priority, the [ProducibleMessage Class](api/classes/ProducibleMessage.md) provides the following methods: -* [ProducibleMessage.prototype.setPriority()](api/classes/ProducibleMessage.md#setpriority) -* [ProducibleMessage.prototype.getPriority()](api/classes/ProducibleMessage.md#getpriority) +* [ProducibleMessage.setPriority()](api/classes/ProducibleMessage.md#setpriority) +* [ProducibleMessage.getPriority()](api/classes/ProducibleMessage.md#getpriority) Valid message priority values that you can apply to a given message are: @@ -104,21 +104,23 @@ A queue name is required to fulfill the following requirements: ## Managing Queues and Namespaces -Queues and Namespaces can be managed using the [Queue](api/classes/Queue.md) and [Namespace](api/classes/Namespace.md) classes which provide the following methods: +Queues and Namespaces can be managed using the [Queue Class](api/classes/Queue.md) and [Namespace Class](api/classes/Namespace.md) which provide the following methods: -1. [Namespace.prototype.getNamespaces()](api/classes/Namespace.md#getnamespaces): To retrieve the list of namespaces. -2. [Namespace.prototype.getNamespaceQueues()](api/classes/Namespace.md#getnamespacequeues): To retrieve the list of queues of a given namespace. -3. [Namespace.prototype.delete()](api/classes/Namespace.md#delete): To delete a namespace alongside with its queues. -4. [Queue.prototype.save()](api/classes/Queue.md#save): To create a queue. -5. [Queue.prototype.list()](api/classes/Queue.md#getqueues): To retrieve the list of queues from all namespaces. -6. [Queue.prototype.delete()](api/classes/Queue.md#delete): To delete a queue. -7. [Queue.prototype.exists()](api/classes/Queue.md#exists): To check of a queue exists. -8. [Queue.prototype.getProperties()](api/classes/Queue.md#getproperties): To retrieve properties of a given queue. +1. [Namespace.getNamespaces()](api/classes/Namespace.md#getnamespaces): To retrieve the list of namespaces. +2. [Namespace.getNamespaceQueues()](api/classes/Namespace.md#getnamespacequeues): To retrieve the list of queues of a given namespace. +3. [Namespace.delete()](api/classes/Namespace.md#delete): To delete a namespace alongside with its queues. +4. [Queue.save()](api/classes/Queue.md#save): To create a queue. +5. [Queue.list()](api/classes/Queue.md#getqueues): To retrieve the list of queues from all namespaces. +6. [Queue.delete()](api/classes/Queue.md#delete): To delete a queue. +7. [Queue.exists()](api/classes/Queue.md#exists): To check of a queue exists. +8. [Queue.getProperties()](api/classes/Queue.md#getproperties): To retrieve properties of a given queue. ## Queue Messages -- [QueueMessages](docs/api/classes/QueueMessages.md) - To browse all queue messages -- [QueuePendingMessages](docs/api/classes/QueuePendingMessages.md) - To browse queue pending messages -- [QueueAcknowledgedMessages](docs/api/classes/QueueAcknowledgedMessages.md) - To browse/requeue/delete queue acknowledged messages -- [QueueDeadLetteredMessages](docs/api/classes/QueueDeadLetteredMessages.md) - To browse/requeue/delete queue dead-lettered messages -- [QueueScheduledMessages](docs/api/classes/QueueScheduledMessages.md) - To browse/delete queue scheduled messages \ No newline at end of file +RedisSMQ provides: + +- [QueueMessages Class](api/classes/QueueMessages.md) - To browse all queue messages +- [QueuePendingMessages Class](api/classes/QueuePendingMessages.md) - To browse queue pending messages +- [QueueAcknowledgedMessages Class](api/classes/QueueAcknowledgedMessages.md) - To browse/requeue/delete queue acknowledged messages +- [QueueDeadLetteredMessages Class](api/classes/QueueDeadLetteredMessages.md) - To browse/requeue/delete queue dead-lettered messages +- [QueueScheduledMessages Class](api/classes/QueueScheduledMessages.md) - To browse/delete queue scheduled messages \ No newline at end of file diff --git a/docs/scheduling-messages.md b/docs/scheduling-messages.md index b4fc4b89..2bc0d6e5 100644 --- a/docs/scheduling-messages.md +++ b/docs/scheduling-messages.md @@ -6,13 +6,13 @@ Starting with version 1.0.19, RedisSMQ enables you to schedule a one-time or rep To set up scheduling parameters for a given message, the [ProducibleMessage Class](api/classes/ProducibleMessage.md) provides: -* [ProducibleMessage.prototype.setScheduledCRON()](api/classes/ProducibleMessage.md#setscheduledcron) -* [ProducibleMessage.prototype.setScheduledDelay()](api/classes/ProducibleMessage.md#setscheduleddelay) -* [ProducibleMessage.prototype.setScheduledRepeat()](api/classes/ProducibleMessage.md#setscheduledrepeat) -* [ProducibleMessage.prototype.setScheduledRepeatPeriod()](api/classes/ProducibleMessage.md#setscheduledrepeatperiod) +* [ProducibleMessage.setScheduledCRON()](api/classes/ProducibleMessage.md#setscheduledcron) +* [ProducibleMessage.setScheduledDelay()](api/classes/ProducibleMessage.md#setscheduleddelay) +* [ProducibleMessage.setScheduledRepeat()](api/classes/ProducibleMessage.md#setscheduledrepeat) +* [ProducibleMessage.setScheduledRepeatPeriod()](api/classes/ProducibleMessage.md#setscheduledrepeatperiod) To schedule your message, you can publish it, as any other message, from your [Producer Class](api/classes/Producer.md) -using the [produce()](api/classes/Producer.md#produce) method. +using the [Producer.produce()](api/classes/Producer.md#produce) method. ```javascript 'use strict';