Skip to content

Commit

Permalink
docs: simplify and unify class/method naming and referencing
Browse files Browse the repository at this point in the history
  • Loading branch information
weyoss committed Jan 28, 2024
1 parent 6abe8bd commit 0299b31
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 60 deletions.
8 changes: 4 additions & 4 deletions docs/consuming-messages.md
Expand Up @@ -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';
Expand Down
28 changes: 14 additions & 14 deletions docs/message-exchanges.md
Expand Up @@ -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');
Expand Down Expand Up @@ -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');
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/message-handler-worker-threads.md
Expand Up @@ -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.
10 changes: 5 additions & 5 deletions docs/messages.md
Expand Up @@ -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
2 changes: 1 addition & 1 deletion docs/multiplexing.md
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion docs/producing-messages.md
Expand Up @@ -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.

Expand Down
10 changes: 5 additions & 5 deletions docs/queue-delivery-models.md
Expand Up @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -99,15 +99,15 @@ 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

If it does not exist a consumer group of a given queue is created automatically when consuming messages from the queue.

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

Expand All @@ -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

Expand Down
8 changes: 4 additions & 4 deletions docs/queue-rate-limiting.md
Expand Up @@ -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**

Expand Down
42 changes: 22 additions & 20 deletions docs/queues.md
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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:

Expand Down Expand Up @@ -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
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
10 changes: 5 additions & 5 deletions docs/scheduling-messages.md
Expand Up @@ -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';
Expand Down

0 comments on commit 0299b31

Please sign in to comment.