To install the necessary dependencies, execute the following command:
npm i @cotton-tail-tech/simple-redis-stream
Import the module into your Node.js application:
const srs = require("@cotton-tail-tech/simple-redis-stream");
Initialize the Redis connection with the following parameters:
srs.init({
host: "localhost",
port: 6379,
});
Subscribe to specific events by providing the event name and a callback function to handle incoming messages:
srs.subscribe("zendesk_api_create", (message) => {
console.log(message);
});
Publish events to the Redis stream with a designated event name and associated data:
srs.publish("zendesk_api_create", { id: 1, name: "test" });
This readme provides a concise overview of how to set up and utilize the Simple Redis Stream module for integrating Redis streams into your Node.js applications.