Skip to content

Commit

Permalink
GITBOOK-183: change request with no subject merged in GitBook
Browse files Browse the repository at this point in the history
  • Loading branch information
manast authored and gitbook-bot committed Dec 4, 2023
1 parent 0379dd9 commit c87354a
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/gitbook/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
* [QueueScheduler](guide/queuescheduler.md)
* [Redis™ Compatibility](guide/redis-tm-compatibility/README.md)
* [Dragonfly](guide/redis-tm-compatibility/dragonfly.md)
* [Redis™ hosting](guide/redis-tm-hosting/README.md)
* [AWS MemoryDB](guide/redis-tm-hosting/aws-memorydb.md)
* [AWS Elasticache](guide/redis-tm-hosting/aws-elasticache.md)
* [Architecture](guide/architecture.md)
* [NestJs](guide/nestjs/README.md)
* [Producers](guide/nestjs/producers.md)
Expand All @@ -60,6 +63,7 @@
* [Process Step Jobs](patterns/process-step-jobs.md)
* [Failing fast when Redis is down](patterns/failing-fast-when-redis-is-down.md)
* [Stop retrying jobs](patterns/stop-retrying-jobs.md)
* [Redis Cluster](patterns/redis-cluster.md)

## BullMQ Pro

Expand Down
9 changes: 8 additions & 1 deletion docs/gitbook/bull/patterns/redis-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@ Bull internals require atomic operations that span different keys. This behavior

In summary, to make bull compatible with Redis cluster, use a queue prefix inside brackets. For example:

You can use two approaches in order to make the Queues compatible with Cluster. Either define a queue prefix:

```typescript
const queue = new Queue('cluster', {
prefix: '{myprefix}'
});
```

If you use several queues in the same cluster, you should use different prefixes so that the queues are evenly placed in the cluster nodes.
or prefix the queue name itself:

```typescript
const queue = new Queue('{cluster}');
```

Note that If you use several queues in the same cluster, you should use different prefixes so that the queues are evenly placed in the cluster nodes, potentially increasing performance and memory usage.
8 changes: 8 additions & 0 deletions docs/gitbook/guide/redis-tm-hosting/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
description: >-
For BullMQ you are going to need a proper Redis™ hosting solution. In this
section we provide instructions on how to use some of the most popular ones.
---

# Redis™ hosting

2 changes: 2 additions & 0 deletions docs/gitbook/guide/redis-tm-hosting/aws-elasticache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# AWS Elasticache

37 changes: 37 additions & 0 deletions docs/gitbook/guide/redis-tm-hosting/aws-memorydb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# AWS MemoryDB

AWS provides a Redis™ 7 compatible managed database that is easy to use and is fully compatible with BullMQ.

There are some considerations to take care when using MemoryDB though.

* MemoryDB only works in Cluster mode. So you need to use "hash tags" so that the queues get attached to a given cluster node ([read more here](../../bull/patterns/redis-cluster.md)).
* MemoryDB can only be accessed within an AWS VPC, so you cannot access the Redis™ cluster outside of AWS.

The easiest way to use MemoryDB with BullMQ is to first instantiate a IORedis Cluster instance, and then use that connection as an option to your workers or queue instances, for example:

```typescript
import { Cluster } from "ioredis"
import { Worker } from "bullmq"

const connection = new Cluster(
[
{
host: "clustercfg.xxx.amazonaws.com",
port: 6379,
},
],
{
tls: {},
}
);

const worker = new Worker("myqueue", async (job: Job) => {
// Do some usefull stuff
}, { connection });

// ...

// Do not forget to close the connection as well as the worker when shutting down
await worker.close();
await connection.quit();
```
2 changes: 2 additions & 0 deletions docs/gitbook/patterns/redis-cluster.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Redis Cluster

0 comments on commit c87354a

Please sign in to comment.