Temporal이 무료 API를 제공합니다: Durable Workflow Engine이 Saga Patterns 없이 Distributed Systems를 신뢰할 수 있게 만듭니다

발행: (2026년 3월 28일 PM 09:29 GMT+9)
5 분 소요
원문: Dev.to

Source: Dev.to

위에 제공된 링크에 포함된 전체 텍스트를 알려주시면, 해당 내용을 한국어로 번역해 드리겠습니다.

Temporal이 실제로 하는 일

Temporal은 오픈소스 내구성 실행 플랫폼입니다. 워크플로우를 일반 코드처럼 (if/else, 루프, 함수 호출) 작성하면, Temporal이 서버가 다운되거나 네트워크가 실패하거나 프로세스가 재시작되더라도 워크플로우가 완료되도록 보장합니다. 워크플로우 코드의 모든 라인은 자동으로 영속화되므로 실행이 정확히 중단된 지점부터 재개됩니다.

Temporal은 메시지 큐, 크론 작업, 사가 패턴, 상태 머신을 하나의 기본 요소인 durable functions(내구성 함수)로 대체합니다. 워크플로우 코드는 일반 함수처럼 보이지만 모든 인프라 장애에 견딜 수 있습니다.

Go, Java, Python, TypeScript, PHP, .NET, Ruby용 SDK가 제공됩니다. 자체 호스팅(무료, 오픈소스)하거나 Temporal Cloud(무료 티어: 월 1000 액션)를 사용할 수 있습니다. 자체 호스팅 버전은 Temporal Cloud를 구동하는 동일한 코드를 실행합니다.

빠른 시작

자체 호스팅

temporal server start-dev

TypeScript SDK

npm install @temporalio/client @temporalio/worker @temporalio/workflow @temporalio/activity

활동 정의 (실제 작업)

// activities.ts
export async function chargePayment(orderId: string, amount: number): Promise {
  const response = await stripe.charges.create({ amount, currency: 'usd' });
  return response.id;
}

export async function sendConfirmation(email: string, orderId: string): Promise {
  await emailService.send({ to: email, template: 'order-confirmed', data: { orderId } });
}

export async function reserveInventory(items: Item[]): Promise {
  return await inventoryService.reserve(items);
}

워크플로 정의 (오케스트레이션)

// workflows.ts
import { proxyActivities } from '@temporalio/workflow';
import type * as activities from './activities';

const { chargePayment, sendConfirmation, reserveInventory } = 
  proxyActivities({
    startToCloseTimeout: '30s',
    retry: { maximumAttempts: 5 }
  });

export async function orderWorkflow(order: Order): Promise {
  // Step 1: Reserve inventory
  const reservationId = await reserveInventory(order.items);

  // Step 2: Charge payment
  const paymentId = await chargePayment(order.id, order.total);

  // Step 3: Send confirmation
  await sendConfirmation(order.email, order.id);

  return paymentId;
  // If any step fails, Temporal retries automatically
  // If the server crashes mid‑workflow, it resumes from the last completed step
}

워크플로 시작

import { Client } from '@temporalio/client';

const client = new Client();
const result = await client.workflow.start(orderWorkflow, {
  taskQueue: 'orders',
  workflowId: `order-${orderId}`,
  args: [order]
});

3 실용적인 사용 사례

1. 장기 실행 비즈니스 프로세스

export async function subscriptionWorkflow(customerId: string) {
  while (true) {
    await chargeMonthly(customerId);
    await sleep('30 days'); // Temporal handles this — even across server restarts

    const status = await checkSubscriptionStatus(customerId);
    if (status === 'cancelled') break;
  }
  await sendCancellationEmail(customerId);
}

수년간 지속되는 구독으로, 배포와 재시작을 몇 번 거쳐도 살아남습니다.

2. 인간이 개입하는 승인 흐름

export async function expenseApproval(expense: Expense) {
  await notifyManager(expense);

  // Wait up to 7 days for manager approval
  const approved = await condition(
    () => approvalReceived,
    '7 days'
  );

  if (approved) {
    await processReimbursement(expense);
  } else {
    await notifyRejection(expense);
  }
}

3. 신뢰할 수 있는 데이터 파이프라인

export async function etlPipeline(source: string) {
  const rawData = await extractData(source);
  const transformed = await transformData(rawData);
  await loadData(transformed);
  await validateData(transformed.id);
  await notifyStakeholders(transformed.summary);
}

각 단계는 실패 시 재시도됩니다. 상태가 지속적으로 저장되며 데이터 손실이 없습니다.

왜 이것이 중요한가

Temporal은 전체 인프라 복잡성 클래스를 제거합니다. 큐, 상태 머신, 크론 작업, 재시도 로직을 엮어내는 대신, 일반 코드를 작성하면 Temporal이 내구성을 처리합니다. 다단계 프로세스, 외부 API 호출, 혹은 장기 실행 작업이 있는 시스템이라면 Temporal은 매우 큰 영향을 미치는 인프라 투자입니다.

0 조회
Back to Blog

관련 글

더 보기 »

아무도 추적하지 않는 AI 코드 부채

6개월 전, 우리 팀은 그 어느 때보다 빠르게 기능을 출시했습니다. 우리는 모든 일에 AI 어시스턴트를 사용했습니다—코드 생성, 디버깅, 아키텍처 결정. The ve...