wip: docker
This commit is contained in:
2
packages/queue/index.ts
Normal file
2
packages/queue/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export { eventsQueue } from './src/queues';
|
||||
export { connection } from './src/connection';
|
||||
30
packages/queue/package.json
Normal file
30
packages/queue/package.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "@mixan/queue",
|
||||
"version": "0.0.1",
|
||||
"main": "index.ts",
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"format": "prettier --check \"**/*.{mjs,ts,md,json}\"",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"bullmq": "^5.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@mixan/eslint-config": "workspace:*",
|
||||
"@mixan/prettier-config": "workspace:*",
|
||||
"@mixan/tsconfig": "workspace:*",
|
||||
"@mixan/types": "workspace:*",
|
||||
"@types/node": "^18.16.0",
|
||||
"eslint": "^8.48.0",
|
||||
"prettier": "^3.0.3",
|
||||
"typescript": "^5.2.2"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"extends": [
|
||||
"@mixan/eslint-config/base"
|
||||
]
|
||||
},
|
||||
"prettier": "@mixan/prettier-config"
|
||||
}
|
||||
10
packages/queue/src/connection.ts
Normal file
10
packages/queue/src/connection.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
const parse = (connectionString: string) => {
|
||||
const url = new URL(connectionString);
|
||||
return {
|
||||
host: url.hostname,
|
||||
port: Number(url.port),
|
||||
password: url.password,
|
||||
} as const;
|
||||
};
|
||||
|
||||
export const connection = parse(String(process.env.REDIS_URL));
|
||||
17
packages/queue/src/queues.ts
Normal file
17
packages/queue/src/queues.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Queue } from 'bullmq';
|
||||
|
||||
import type { BatchPayload } from '@mixan/types';
|
||||
|
||||
import { connection } from './connection';
|
||||
|
||||
export interface EventsQueuePayload {
|
||||
projectId: string;
|
||||
payload: BatchPayload[];
|
||||
}
|
||||
|
||||
export const eventsQueue = new Queue<EventsQueuePayload>('events', {
|
||||
connection,
|
||||
defaultJobOptions: {
|
||||
removeOnComplete: 10,
|
||||
},
|
||||
});
|
||||
12
packages/queue/tsconfig.json
Normal file
12
packages/queue/tsconfig.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"extends": "@mixan/tsconfig/base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
},
|
||||
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json"
|
||||
},
|
||||
"include": ["."],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
Reference in New Issue
Block a user