Sequential Pipeline

Data ProcessingEasy
Applicability

When to Use

Tasks have a clear, linear sequence of operations
Each step depends on the output of the previous step
Error handling needs to be straightforward
Debugging and logging benefit from step-by-step tracing
Overview

How It Works

The Sequential Pipeline pattern processes data through a series of ordered steps. Each step receives input, performs its operation, and passes the result to the next step. If any step fails, the pipeline stops and reports the error with context about which step failed and why. This pattern is ideal for ETL workflows, document processing, and any task where operations must happen in a specific order.
Implementation

Code Example

javascript
class SequentialPipeline {
  constructor(steps) {
    this.steps = steps;
  }

  async execute(input) {
    let result = input;
    for (const step of this.steps) {
      console.log(`Executing: ${step.name}`);
      result = await step.handler(result);
    }
    return result;
  }
}

// Usage
const pipeline = new SequentialPipeline([
  { name: "extract", handler: extractData },
  { name: "transform", handler: transformData },
  { name: "validate", handler: validateData },
  { name: "load", handler: loadData },
]);

const result = await pipeline.execute(sourceConfig);

Quick Info

CategoryData Processing
ComplexityEasy

Related Patterns

Related MCP Servers

Need Architecture Help?

Our team designs custom automation architectures.

Get in Touch
CortexAgent Customer Service

Want to skip the form?

Our team is available to help you get started with CortexAgent.

This chat may be recorded for quality assurance. You can view our Privacy Policy.