import { Queue } from "bullmq"; import { redisConnection } from "./redis"; /** * Queue names are shared across the Node (api-daemon) and Python (worker) * services via the protocol-compatible `bullmq` package on both sides. * Keep this list in sync with apps/worker/worker/queues.py. */ export const QUEUE_NAMES = { STREAM_INGEST: "stream-ingest", SIGNAL_DETECTION: "signal-detection", STT_SCORING: "stt-scoring", // Defined for future modules (render/distribution) — no processor yet. VIDEO_RENDER: "video-render", POST_PUBLISH: "post-publish", } as const; export interface StreamIngestJob { sessionId: string; channelDbId: string; youtubeUrl: string; /** Kanala özel segment süresi (sn) — verilmezse env.segmentTimeSec kullanılır. */ segmentTimeSec?: number; } export interface SignalDetectionJob { rawSegmentId: string; filePath: string; sessionId: string; } export const streamIngestQueue = new Queue(QUEUE_NAMES.STREAM_INGEST, { connection: redisConnection, }); export const signalDetectionQueue = new Queue(QUEUE_NAMES.SIGNAL_DETECTION, { connection: redisConnection, }); export interface VideoRenderJob { candidateSegmentId: string; } // Consumed by the Python worker (apps/worker/worker/video_render.py) — job // name/payload shape must match what stt_scoring.py already enqueues. export const videoRenderQueue = new Queue(QUEUE_NAMES.VIDEO_RENDER, { connection: redisConnection, });