Skip to content

Orchestration module #21

@Villarley

Description

@Villarley

Orchestration Module - Complete aggregation pipeline

📝 Description

Create an orchestration module that integrates all previous services (reception, normalization, outlier detection, aggregation, storage) into a cohesive pipeline. This module should coordinate the data flow from reception to final storage, handling errors and retries at each stage.

Context: Now that all individual components are implemented, we need an orchestrator to connect and coordinate them. This is the "brain" of the aggregator that decides what to do with each received price.

Tech Stack:

  • NestJS Module with providers
  • RxJS for reactive pipeline
  • Event-driven architecture
  • TypeScript with strict types

✅ Requirements

  • Implement an AggregatorOrchestrationService that coordinates the complete pipeline
  • Flow: Reception → Normalization → Outlier Detection → Aggregation → Storage
  • Implement event-driven architecture (each stage emits events)
  • Handle errors at each stage without stopping the complete pipeline
  • Implement circuit breaker to prevent failure cascades
  • Add detailed logging of the flow of each price
  • Implement throughput and latency metrics per stage
  • Configure aggregation intervals via environment variables
  • Allow both real-time and batch processing

🎯 Acceptance Criteria

  • The complete pipeline executes correctly from start to finish
  • Each received price goes through all stages in order
  • Errors at one stage are handled without crashing the pipeline
  • Events are emitted at each stage for observability
  • Circuit breaker is implemented that stops processing if there are many failures
  • Latency and throughput metrics are logged per stage
  • Integration tests of the complete pipeline exist (>75% coverage)
  • The complete flow is documented with diagrams

📁 Expected files to change/structure

  • apps/aggregator/src/modules/aggregator-orchestration.module.ts - Main module
  • apps/aggregator/src/services/orchestration.service.ts - Orchestrator service
  • apps/aggregator/src/services/orchestration.service.spec.ts - Tests
  • apps/aggregator/src/events/ - Event definitions
    • price-received.event.ts
    • price-normalized.event.ts
    • price-aggregated.event.ts
  • apps/aggregator/src/middleware/circuit-breaker.middleware.ts - Circuit breaker
  • apps/aggregator/src/app.module.ts - Import orchestration module
  • apps/aggregator/README.md - Document pipeline and architecture
  • apps/aggregator/.env.example - Configuration variables

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions