@boringnode/queue 0.0.1-alpha.1 → 0.0.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ npm install @boringnode/queue
|
|
|
10
10
|
|
|
11
11
|
## Features
|
|
12
12
|
|
|
13
|
-
- **Multiple Queue Adapters**: Support for Redis (
|
|
13
|
+
- **Multiple Queue Adapters**: Support for Redis, Knex (PostgreSQL, MySQL, SQLite), and Sync
|
|
14
14
|
- **Type-Safe Jobs**: Define jobs as TypeScript classes with typed payloads
|
|
15
15
|
- **Delayed Jobs**: Schedule jobs to run after a specific delay
|
|
16
16
|
- **Multiple Queues**: Organize jobs into different queues for better organization
|
|
@@ -173,6 +173,38 @@ import { sync } from '@boringnode/queue/drivers/sync_adapter'
|
|
|
173
173
|
const adapter = sync()
|
|
174
174
|
```
|
|
175
175
|
|
|
176
|
+
### Knex Adapter
|
|
177
|
+
|
|
178
|
+
For SQL databases (PostgreSQL, MySQL, SQLite) using Knex:
|
|
179
|
+
|
|
180
|
+
```typescript
|
|
181
|
+
import { knex } from '@boringnode/queue/drivers/knex_adapter'
|
|
182
|
+
|
|
183
|
+
// With configuration (adapter manages connection lifecycle)
|
|
184
|
+
const adapter = knex({
|
|
185
|
+
client: 'pg',
|
|
186
|
+
connection: {
|
|
187
|
+
host: 'localhost',
|
|
188
|
+
port: 5432,
|
|
189
|
+
user: 'postgres',
|
|
190
|
+
password: 'postgres',
|
|
191
|
+
database: 'myapp',
|
|
192
|
+
},
|
|
193
|
+
})
|
|
194
|
+
|
|
195
|
+
// Or with an existing Knex instance (you manage connection lifecycle)
|
|
196
|
+
import Knex from 'knex'
|
|
197
|
+
|
|
198
|
+
const connection = Knex({ client: 'pg', connection: '...' })
|
|
199
|
+
const adapter = knex(connection)
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
The adapter automatically creates the `queue_jobs` table on first use. You can customize the table name:
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
const adapter = knex(config, 'custom_jobs_table')
|
|
206
|
+
```
|
|
207
|
+
|
|
176
208
|
## Worker Configuration
|
|
177
209
|
|
|
178
210
|
Workers process jobs from one or more queues:
|