Skip to content

Commit

Permalink
docs: update configuration.md
Browse files Browse the repository at this point in the history
  • Loading branch information
weyoss committed Nov 21, 2023
1 parent b29afcb commit 83ce680
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 12 deletions.
4 changes: 2 additions & 2 deletions docs/api/interfaces/IRedisSMQConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

### logger

> **logger**?: `ILoggerConfig`
> **logger**?: [`ILoggerConfig`](https://github.com/weyoss/redis-smq-common/blob/master/docs/api/interfaces/ILoggerConfig.md)
***

Expand All @@ -39,5 +39,5 @@

### redis

> **redis**?: `IRedisConfig`
> **redis**?: [`IRedisConfig`](https://github.com/weyoss/redis-smq-common/blob/master/docs/api/README.md#iredisconfig)
49 changes: 39 additions & 10 deletions docs/configuration.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,45 @@
>[RedisSMQ](../README.md) / [Docs](README.md) / Configuration
> [RedisSMQ](../README.md) / [Docs](README.md) / Configuration
# Configuration

You can configure many of RedisSMQ features using a config object that you can pass in to a configurable component (for example a Consumer constructor).
RedisSMQ configuration is a one-time setup that takes place, usually, during your application initialization and before
using any exported class or function from the library.

To register a configuration object RedisSMQ provides a singleton class that may be used as shown bellow:

```javascript
'use strict';
const { Configuration, ERedisConfigClient } = require('redis-smq');

const config = {
redis: {
client: ERedisConfigClient.IOREDIS,
options: {
host: '127.0.0.1',
port: 6379,
},
},
}

Configuration.getSetConfig(config);
```

See [Configuration Class Reference](api/classes/Configuration.md) for more details.

## Configuration parameters

See [IRedisSMQConfig Interface](api/interfaces/IRedisSMQConfig.md) for more details.

**Configuration Example**

```javascript
'use strict';
const path = require('path');
const { ERedisConfigClient } = require('redis-smq');

module.exports = {
namespace: 'my_project_name',
redis: {
client: 'redis',
client: ERedisConfigClient.IOREDIS,
options: {
host: '127.0.0.1',
port: 6379,
Expand All @@ -39,14 +62,20 @@ module.exports = {
messages: {
store: false,
},

};
```

**Parameters**
#### Message Storage

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
dead-lettered messages for example.

By default acknowledged and dead-lettered messages are not stored.

See [IRedisSMQConfig Interface](api/interfaces/IRedisSMQConfig.md) for more details.

**messages.store Usage Examples**

- Only storing dead-lettered messages:
Expand Down Expand Up @@ -93,4 +122,4 @@ const config = {
}
}
}
```
```

0 comments on commit 83ce680

Please sign in to comment.