Skip to content

Commit

Permalink
docs: update messages and queues documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
weyoss committed Jan 28, 2024
1 parent 140322e commit 7c3d06e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ A queue is responsible for holding messages which are produced by producers and

```javascript
const queue = new Queue();
queue.save('my_queue', EQueueType.LIFO_QUEUE, EQueueDeliveryModel.POINT_TO_POINT, (err) => console.error(err));
queue.save('my_queue', EQueueType.LIFO_QUEUE, EQueueDeliveryModel.POINT_TO_POINT, (err) => {
if (err) console.error(err)
});
```

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).
Expand All @@ -80,7 +82,10 @@ See [Queues](docs/queues.md) for more details.
```javascript
const msg = new ProducibleMessage();
msg.setQueue('my_queue').setBody('Hello Word!')
producer.produce(msg, (err) => console.error(err));
producer.produce(msg, (err, ids) => {
if (err) console.error(err);
else console.log(`Produced message IDs are: ${ids.join(', ')}`)
});
```

See [Producing Messages](docs/producing-messages.md) for more details.
Expand All @@ -93,7 +98,9 @@ const messageHandler = (msg, cb) => {
console.log(msg.body);
cb();
}
consumer.consume('my_queue', messageHandler, (err) => console.error(err));
consumer.consume('my_queue', messageHandler, (err) => {
if (err) console.error(err);
});
```

See [Consuming Messages](docs/consuming-messages.md) for more details.
Expand Down
13 changes: 9 additions & 4 deletions docs/messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ msg.setBody({hello: 'world'})

The `ProducibleMessage` class provides many methods for setting up different delivery/consumption parameters such as message priority, message TTL, retry threshold, etc.

For more details see:

- [ProducibleMessage Class](api/classes/ProducibleMessage.md)
- [Message Class](api/classes/Message.md)
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
8 changes: 8 additions & 0 deletions docs/queues.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,11 @@ Queues and Namespaces can be managed using the [Queue](api/classes/Queue.md) and
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.

## 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

0 comments on commit 7c3d06e

Please sign in to comment.