77## Features
88
99- ** Type-safe** : Full TypeScript support with generic job payloads
10- - ** Multiple adapters** : Drizzle ORM (PostgreSQL), Prisma ORM (PostgreSQL), and in-memory implementations
10+ - ** Multiple adapters** : Drizzle ORM (PostgreSQL), Prisma ORM (PostgreSQL), Kysely (PostgreSQL) and in-memory implementations
1111- ** Priority queues** : Numeric priority system (lower = higher priority)
1212- ** Delayed jobs** : Schedule jobs for future execution
1313- ** Recurring jobs** : Cron expressions and interval-based repetition
14+ - ** Batch processing** : Process multiple jobs concurrently for higher efficiency and better performance by supporting parallel execution and grouping of jobs.
1415- ** UTC-first timezone support** : Reliable timezone handling with UTC storage
1516- ** Progress tracking** : Real-time job progress updates
1617- ** Event system** : Listen to job lifecycle events
2425│ ├── core/ # Core queue logic and interfaces
2526│ ├── adapter-drizzle/ # Drizzle ORM adapter (PostgreSQL)
2627│ └── adapter-prisma/ # Prisma ORM adapter (PostgreSQL)
28+ │ └── adapter-kysely/ # Kysely adapter (PostgreSQL)
2729├── examples/ # Standalone usage examples
2830└── tooling/ # Shared development tools
2931```
@@ -49,9 +51,14 @@ pnpm add @vorsteh-queue/core @vorsteh-queue/adapter-drizzle
4951
5052``` typescript
5153// Drizzle ORM with PostgreSQL
54+
55+ // Prisma ORM with PostgreSQL
56+ import { PrismaClient } from " @prisma/client"
5257import { drizzle } from " drizzle-orm/node-postgres"
5358import { Pool } from " pg"
59+
5460import { PostgresQueueAdapter } from " @vorsteh-queue/adapter-drizzle"
61+ import { PostgresPrismaQueueAdapter } from " @vorsteh-queue/adapter-prisma"
5562import { Queue } from " @vorsteh-queue/core"
5663
5764interface EmailPayload {
@@ -69,10 +76,6 @@ const pool = new Pool({ connectionString: "postgresql://..." })
6976const db = drizzle (pool )
7077const queue = new Queue (new PostgresQueueAdapter (db ), { name: " my-queue" })
7178
72- // Prisma ORM with PostgreSQL
73- import { PrismaClient } from " @prisma/client"
74- import { PostgresPrismaQueueAdapter } from " @vorsteh-queue/adapter-prisma"
75-
7679const prisma = new PrismaClient ()
7780const queue = new Queue (new PostgresPrismaQueueAdapter (prisma ), { name: " my-queue" })
7881
@@ -139,6 +142,26 @@ await queue.add("health-check", payload, {
139142})
140143```
141144
145+ ## Batch Processing
146+
147+ Process multiple jobs in a single batch for higher throughput and efficiency.
148+
149+ ``` typescript
150+ queue .registerBatch <{ file: string }, { ok: boolean }>(" process-files" , async (jobs ) => {
151+ console .log (` Processing batch of ${jobs .length } files... ` )
152+ return jobs .map (() => ({ ok: true }))
153+ })
154+
155+ await queue .addJobs (" process-files" , [{ file: " a.csv" }, { file: " b.csv" }, { file: " c.csv" }])
156+
157+ queue .on (" batch:processing" , (jobs ) => {
158+ console .log (` Batch started: ${jobs .length } jobs ` )
159+ })
160+ queue .on (" batch:completed" , (jobs ) => {
161+ console .log (` Batch completed: ${jobs .length } jobs ` )
162+ })
163+ ```
164+
142165## Job Cleanup
143166
144167``` typescript
0 commit comments