Redis 없이: Zero-Config 작업 큐 for Bun

발행: (2026년 2월 2일 오전 10:24 GMT+9)
2 분 소요
원문: Dev.to

Source: Dev.to

Using Bunqueue without Redis

import { Queue, Worker } from 'bunqueue/client';

const queue = new Queue('tasks', { embedded: true });

await queue.add('process', { userId: 123 });

new Worker('tasks', async (job) => {
  return { done: true };
}, { embedded: true });

그게 전체 인프라스트럭처입니다—Redis도, Docker도, 연결 문자열도, 별도의 서버 프로세스도 필요 없습니다.

Embedded Mode

embedded: true 를 설정하면 Bunqueue가 프로젝트 내에 SQLite 데이터베이스를 생성하고 모든 것을 프로세스 내부에서 관리합니다:

Your App Process
├── Your Code
├── Queue (in‑memory priority queues)
├── Worker (processes jobs)
└── SQLite (./data/bunq.db)

하나의 프로세스. 하나의 파일. 끝.

Example: Email Queue

import { Queue, Worker } from 'bunqueue/client';

interface EmailJob {
  to: string;
  template: string;
  data: Record;
}

const emails = new Queue('emails', { embedded: true });

// Add jobs from your API routes
await emails.add(
  'welcome',
  {
    to: 'user@example.com',
    template: 'welcome',
    data: { name: 'John' },
  },
  {
    attempts: 3,
    backoff: 5000,
    priority: 10,
  }
);

// Process in the same app
const worker = new Worker(
  'emails',
  async (job) => {
    await job.updateProgress(10, 'Loading template');

    const html = await renderTemplate(job.data.template, job.data.data);

    await job.updateProgress(50, 'Sending');
    await sendEmail(job.data.to, html);

    return { sent: true };
  },
  {
    embedded: true,
    concurrency: 5,
  }
);

worker.on('failed', (job, err) => {
  console.error(`Email to ${job.data.to} failed: ${err.message}`);
});

Installation

bun add bunqueue

Resources

Back to Blog

관련 글

더 보기 »

React란 무엇이며 왜 배워야 할까요?

React이란? React은 Facebook(현재 Meta)에서 개발한 오픈소스 JavaScript 라이브러리입니다. 개발자들이 빠르고 동적인 사용자 인터페이스를 만들 수 있도록 UI를 ...