Redis queue client implementation for Axiom Lattice framework
npm install @axiom-lattice/queue-redisRedis queue client implementation for the Axiom Lattice framework.
This package provides a Redis-based queue client implementation that conforms to the QueueClient interface defined in @axiom-lattice/protocols. It can be used with the QueueLatticeManager from @axiom-lattice/core to register and manage Redis-based queue services.
``bash`
pnpm add @axiom-lattice/queue-redis
`typescript
import { RedisQueueClient } from "@axiom-lattice/queue-redis";
import { registerQueueLattice } from "@axiom-lattice/core";
import { QueueType } from "@axiom-lattice/protocols";
// Register Redis queue service
registerQueueLattice("redis-queue", {
name: "Redis Queue Service",
description: "Redis-based queue service",
type: QueueType.REDIS,
queueName: "tasks",
options: {
redisUrl: process.env.REDIS_URL || "redis://localhost:6379",
redisPassword: process.env.REDIS_PASSWORD,
},
});
// Get and use the queue
import { getQueueLattice } from "@axiom-lattice/core";
const queue = getQueueLattice("redis-queue");
// Push item to queue
await queue.push({ task: "example" });
// Pop item from queue
const result = await queue.pop();
`
`typescript
import { RedisQueueClient } from "@axiom-lattice/queue-redis";
const client = new RedisQueueClient("tasks", {
redisUrl: "redis://localhost:6379",
redisPassword: "your-password",
});
// Push item
await client.push({ data: "example" });
// Pop item
const result = await queue.pop();
`
The Redis queue client can be configured via:
1. Constructor options: Pass redisUrl and redisPassword directlyREDIS_URL
2. Environment variables:
- (default: redis://localhost:6379)REDIS_PASSWORD` (optional)
-
MIT