DPDK Architecture  ->  Bootstrap (v3.0.5)

Redis Message Bus (Pub/Sub)
>= v1.22.4

If you need to send real time messages between the servers in a multi server setup you can use Redis Pub/Sub to accomplish this.
This module is disabled by default but can be configured via config.

Config
>= v1.22.4

{
  "redis": {
    "enabled": false,
    "host": "127.0.0.1",
    "port": 6379,
    "scope": "dpdk_npm_next_bootstrap"
  }
}

Sending data
>= v1.22.4

const bootstrap = new NextBootstrap(__dirname, process.cwd(), nextConfig);
bootstrap.init();

// Returns: true/false based on the fact if the message was received by the server
// Params: channel, message
const messageStatus = bootstrap.redis.client.publish('example', {
    message: 'Hello World'
});

Receiving data
>= v1.22.4

const bootstrap = new NextBootstrap(__dirname, process.cwd(), nextConfig);
bootstrap.init();

// Returns: the unsubscribe function along the current subscribed channel
// Params: channel, callback
const exampleChannel = bootstrap.redis.client.subscribe('example', (data) => {
    console.log(data);
});

Additional Redis Pub/Sub Library Documentation: https://www.npmjs.com/package/node-redis-pubsub

Additional Redis Pub/Sub Documentation: https://redis.io/topics/pubsub

Last modifiedFriday, April 30, 2021, 12:00:21 PM UTC
Last authorColin van Eenige
Commit ID4c7a701