Mongoose server Architecture Overview¶
Introduction¶
Mongoose server is an event-driven application framework designed to process events from various sources, route them to appropriate handlers, and manage the lifecycle of event processors and services. This document provides a comprehensive overview of the Mongoose server architecture, including component diagrams and descriptions of key components.
High-Level Architecture¶
Mongoose server follows an event-driven architecture pattern where events flow from sources to processors through a managed event flow system. The architecture consists of the following main components:
- FluxtionServer - The main server class that bootstraps and manages the entire system
- EventFlowManager - Manages the flow of events between sources and processors
- EventSource - Interfaces for components that generate events
- EventProcessors - Components that process events
- Services - Various services that provide functionality to the system
Component Diagram¶
┌─────────────────────────────────────────────────────────────────────┐
│ Mongoose server │
│ │
│ ┌───────────────┐ ┌───────────────┐ ┌───────────────┐ │
│ │ Event Sources│──────▶│ Event Flow │─────▶│ Event │ │
│ │ │ │ Manager │ │ Processors │ │
│ └───────────────┘ └───────────────┘ └───────────────┘ │
│ ▲ │ │ │
│ │ │ │ │
│ │ ▼ │ │
│ ┌───────────────┐ ┌───────────────┐ ┌───────────────┐ │
│ │ Services │◀──────│ Configuration │◀─────│ Admin │ │
│ │ │ │ │ │ Interface │ │
│ └───────────────┘ └───────────────┘ └───────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────┘
Key Components¶
FluxtionServer¶
The FluxtionServer class is the main entry point and controller for the system. It is responsible for:
- Bootstrapping the server with configuration
- Managing the lifecycle of event processors and services
- Registering event sources and services
- Coordinating the event flow
EventFlowManager¶
The EventFlowManager is responsible for managing the flow of events between sources and processors. It:
- Registers event sources
- Maps events to appropriate processors
- Manages subscriptions between event sources and processors
- Provides the infrastructure for event routing
Event Sources¶
Event sources are components that generate events. They implement the EventSource interface and are responsible for:
- Generating events from external or internal sources
- Publishing events to the event flow system
- Managing subscriptions from event processors
Event Processors¶
Event processors consume and process events. They are managed by the ComposingEventProcessorAgent and are responsible for:
- Subscribing to event sources
- Processing events according to business logic
- Generating output or side effects
Services¶
Services provide various functionalities to the system. They can be:
- Event sources that generate events
- Event processors that consume events
- Standalone services that provide utility functions
Event Flow Architecture¶
The event flow in Mongoose server follows this pattern:
- Event sources generate events
- Events are published to the EventFlowManager
- EventFlowManager routes events to appropriate queues
- Event processors consume events from queues
- Event processors process events and may generate new events
Event Flow Diagram¶
┌───────────────┐ ┌───────────────┐ ┌───────────────┐
│ Event Source │────▶│ Event Queue │────▶│ Event │
│ │ │ │ │ Processor │
└───────────────┘ └───────────────┘ └───────────────┘
│
│
▼
┌───────────────┐ ┌───────────────┐ ┌───────────────┐
│ Event Source │◀────│ Event Queue │◀────│ New Event │
│ (Output) │ │ (Output) │ │ Generation │
└───────────────┘ └───────────────┘ └───────────────┘
Configuration System¶
Mongoose server uses a configuration system based on YAML files. The configuration defines:
- Event sources and their properties
- Event processors and their grouping
- Services and their configuration
- Threading and performance settings
Lifecycle Management¶
Mongoose server manages the lifecycle of components through these phases:
- Initialization - Components are created and initialized
- Start - Components are started and begin processing
- Running - Normal operation where events are processed
- Stop - Components are gracefully stopped
- Teardown - Resources are released
Threading Model¶
Mongoose server uses a threading model based on agents:
- Each event processor group runs in its own thread
- Services can run in their own threads or be hosted by agents
- Event queues provide thread-safe communication between components
Conclusion¶
The Mongoose server architecture provides a flexible and scalable framework for building event-driven applications. Its component-based design allows for easy extension and customization, while the event flow management system ensures efficient routing and processing of events.