# sarang10/dropwizard-rabbitmq-actors architecture

> Architecture diagram of the GitHub repository sarang10/dropwizard-rabbitmq-actors, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sarang10/dropwizard-rabbitmq-actors
- Repository: https://github.com/sarang10/dropwizard-rabbitmq-actors

## Overview

##### Main Components
- Actor Abstraction Layer: This is the core of the library and is organized under the “actors” packages. It includes:
- Actor and Actor Configurations (BaseActor, ActorConfig, and associated classes in the “actor” package).
- Managed and unmanaged actors for different use cases.
- Connectivity and Configuration:
- Classes in the “connectivity” package manage RabbitMQ connections, including configuration (ConnectionConfig, RMQConnection) and connection isolation strategies (DefaultConnectionStrategy, SharedConnectionStrategy).
- The “config” package holds configuration classes, including broker, RMQ, and metric configurations.
- Exception Handling:
- The “exceptionhandler” package handles errors via multiple handlers (e.g., MessageDropHandler, MessageSidelineHandler) and associates configuration classes.
- Retry Strategies:
- The “retry” package offers various retry strategies (count-limited vs. time-limited, exponential, fixed, or incremental waits) along with configuration and implementation classes.
- Metrics and Observation:
- The “metrics” package, along with “observers”, provides metric data capture and observation mechanisms for actor interactions.
- Utilities:
- Utility classes under “utils” and “common” to support naming, constants, and common operations.

##### Relationships and Interactions
- The Dropwizard bundle (RabbitmqActorBundle) serves as the integration point that injects actor functionality into a Dropwizard application.
- The Actor Abstraction Layer (with its various actor types) interacts with the RabbitMQ infrastructure through the Connectivity and Configuration modules.
- Configuration components feed settings into actors, connectivity components, and retry mechanisms.
- Exception handlers intercept failures during actor message processing and use the configurations from the exceptionhandler package.
- Metrics and observers monitor both the actor behavior and RabbitMQ connectivity; data is funneled into the metrics module.
- Retry strategies are plugged into scenarios where message processing or connectivity issues demand additional handling.

##### Architectural Patterns and Design Choices
- Modularity: The source structure clearly separates concerns into packages (actors, connectivity, configuration, exception handling, metrics, retry).
- Abstraction: The actor and connection strategies use abstraction and visitor patterns (evidenced by “Visitor” classes) to handle different actor behaviors and connection management flows.
- Extensibility: Configurations and modular retry strategies indicate that the design supports extension points for further customization.
- Integration with Dropwizard: The bundle structure makes it easy to integrate with Dropwizard-powered applications.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Subgraphs
    subgraph "Dropwizard Integration"
        Bundle["RabbitmqActorBundle"]:::integration
    end

    subgraph "Connectivity & Configuration"
        Config["Global Configuration<br/>(Broker, RMQConfig, MetricConfig)"]:::config
        Connectivity["Connectivity<br/>(RMQConnection, ConnectionConfig)"]:::connectivity
    end

    subgraph "Actor Processing Layer"
        Actor["Actor Abstraction Layer<br/>(BaseActor, ActorConfig)"]:::actor
    end

    subgraph "Error & Retry Handling"
        Exception["Exception Handling<br/>(MessageDropHandler, etc.)"]:::error
        Retry["Retry Strategies<br/>(Exponential, Fixed, etc.)"]:::retry
    end

    subgraph "Metrics & Observation"
        Metrics["Metrics<br/>(Data Capture)"]:::metrics
        Observers["Observers<br/>(Monitoring)"]:::metrics
    end

    subgraph "Utilities"
        Utils["Utils"]:::utilities
        Common["Common"]:::utilities
    end

    %% Connections
    Bundle -->|"injectsConfig"| Config
    Bundle -->|"initConnectivity"| Connectivity
    Bundle -->|"initializesActors"| Actor

    Config -->|"providesSettings"| Connectivity
    Config -->|"configuresActors"| Actor

    Connectivity -->|"establishesConnection"| Actor

    Actor -->|"sendsMetrics"| Metrics
    Actor -->|"notifiesObservers"| Observers
    Actor -->|"onError"| Exception

    Exception -->|"triggersRetry"| Retry
    Retry -->|"retriesActor"| Actor

    Actor -->|"utilizes"| Utils
    Actor -->|"utilizes"| Common

    %% Click Events
    click Bundle "https://github.com/sarang10/dropwizard-rabbitmq-actors/blob/master/src/main/java/io/appform/dropwizard/actors/RabbitmqActorBundle.java"
    click Actor "https://github.com/sarang10/dropwizard-rabbitmq-actors/tree/master/src/main/java/io/appform/dropwizard/actors/actor"
    click Connectivity "https://github.com/sarang10/dropwizard-rabbitmq-actors/tree/master/src/main/java/io/appform/dropwizard/actors/connectivity"
    click Config "https://github.com/sarang10/dropwizard-rabbitmq-actors/tree/master/src/main/java/io/appform/dropwizard/actors/config"
    click Exception "https://github.com/sarang10/dropwizard-rabbitmq-actors/tree/master/src/main/java/io/appform/dropwizard/actors/exceptionhandler"
    click Retry "https://github.com/sarang10/dropwizard-rabbitmq-actors/tree/master/src/main/java/io/appform/dropwizard/actors/retry"
    click Metrics "https://github.com/sarang10/dropwizard-rabbitmq-actors/tree/master/src/main/java/io/appform/dropwizard/actors/metrics"
    click Observers "https://github.com/sarang10/dropwizard-rabbitmq-actors/tree/master/src/main/java/io/appform/dropwizard/actors/observers"
    click Utils "https://github.com/sarang10/dropwizard-rabbitmq-actors/tree/master/src/main/java/io/appform/dropwizard/actors/utils"
    click Common "https://github.com/sarang10/dropwizard-rabbitmq-actors/tree/master/src/main/java/io/appform/dropwizard/actors/common"

    %% Styles
    classDef integration fill:#f4d03f,stroke:#333,stroke-width:2px;
    classDef actor fill:#82e0aa,stroke:#333,stroke-width:2px;
    classDef connectivity fill:#f5b041,stroke:#333,stroke-width:2px;
    classDef config fill:#85c1e9,stroke:#333,stroke-width:2px;
    classDef error fill:#e74c3c,stroke:#333,stroke-width:2px;
    classDef retry fill:#f39c12,stroke:#333,stroke-width:2px;
    classDef metrics fill:#af7ac5,stroke:#333,stroke-width:2px;
    classDef utilities fill:#95a5a6,stroke:#333,stroke-width:2px;
```
