# naveengarla/cloud-design-patterns architecture

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

- Interactive diagram: https://gitdiagram.com/naveengarla/cloud-design-patterns
- Repository: https://github.com/naveengarla/cloud-design-patterns

## Overview

This repository, titled “Cloud Design Patterns,” is a collection of sample projects from Microsoft’s patterns & practices that demonstrates multiple cloud-based design patterns. The overall purpose is to illustrate different architectural problems and solutions that can be deployed in cloud environments, showing how to implement patterns such as competing consumers, compute resource consolidation, external configuration storage, health endpoint monitoring, leader election, pipes and filters, various implementations of priority queues (including one designed for Service Fabric), static content hosting, and valet key security.

##### Main Components
- Each major subdirectory (e.g., competing-consumers, compute-resource-consolidation, external-configuration-store, health-endpoint-monitoring, leader-election, pipes-and-filters, priority-queue-sf, priority-queue, static-content-hosting, valet-key) represents a distinct cloud design pattern sample.
- Within each sample, note key components such as:
– Worker roles, sender and receiver roles, or role entry points (as seen in WorkerRole.cs, Sender, Receiver, etc.).
– Shared libraries used across the projects (e.g., “CompetingConsumers.Shared”, “PipesAndFilters.Shared”, “PriorityQueue.Shared”).
– Configuration elements for cloud deployments (ServiceDefinition.csdef, ServiceConfiguration.Cloud.cscfg, ServiceConfiguration.Local.cscfg) which indicate how these projects are intended to run in different environments.
– Specific technology stacks (for example, the use of Azure Service Fabric in “priority-queue-sf”, and the typical ASP.NET MVC/Web API framework seen in “HealthEndPointMonitoring.Web” and “ValetKey.Web”).

##### Relationships and Interactions Between Components
- For each design pattern sample, identify directional data flows:
– For the pipes and filters sample, delineate how the data flows from the initial sender through the filters (e.g., PipeFilterA and PipeFilterB) to the final receiver.
– In priority queue implementations, show the flow from message sender components through the queue (potentially also representing two different priority levels – high and low) towards worker services processing those messages.
– Demonstrate typical cloud deployment architectures through the inclusion of Worker Roles, Web Roles, and supporting configuration files that indicate a multi-node deployment or Service Fabric cluster.

##### Important Architectural Patterns and Design Principles
- Separation of concerns: Many components are split into projects (e.g., shared libraries versus functional modules) to promote reusability.
- Decoupling between message producers and consumers (competing consumer and priority queue patterns).
- Extensibility of patterns like pipes and filters where independent filters can be chained.
- Point out cloud deployment best practices as shown by separate cloud and local configurations.
- That some projects are set up for Service Fabric (priority-queue-sf), indicating microservice or distributed system practices.

##### Relevant Technologies, Frameworks, and Libraries
- .NET framework elements (e.g., csproj files, app.config) are used throughout.
- Azure-specific cloud deployment configuration files and roles (ServiceConfiguration.*, ServiceDefinition.csdef) signify cloud infrastructure.
- Use of ASP.NET MVC / Web API in projects like “HealthEndPointMonitoring.Web” and “ValetKey.Web” should be identified.
- Shared utility components (e.g., QueueManager.cs) that are central to processing patterns.

## Diagram (Mermaid)

```mermaid
flowchart TD
    repo["Cloud Design Patterns Repository"]:::repo

    %% Competing Consumers Sample
    subgraph "Competing Consumers Sample"
        compSender["Sender Role"]:::worker
        compReceiver["Receiver Role"]:::worker
        compShared["Shared Library"]:::shared
        compSender -->|"calls"| compShared
        compReceiver -->|"calls"| compShared
        compSender -->|"sends"| compReceiver
    end
    repo --> compSender

    %% Compute Resource Consolidation Sample
    subgraph "Compute Resource Consolidation Sample"
        compResWorker["Worker Role"]:::worker
    end
    repo --> compResWorker

    %% External Configuration Store Sample
    subgraph "External Configuration Store Sample"
        extConfig["Configuration Manager"]:::config
        extCloud1["Cloud Config: ServiceConfiguration.Cloud.cscfg"]:::config
        extCloud2["Cloud Config: ServiceDefinition.csdef"]:::config
        extCloud1 -->|"configures"| extConfig
        extCloud2 -->|"defines"| extConfig
    end
    repo --> extConfig

    %% Health Endpoint Monitoring Sample
    subgraph "Health Endpoint Monitoring Sample"
        healthController["HealthCheckController"]:::web
        healthWebRole["WebRole"]:::worker
        healthCloud["Cloud Config"]:::config
        healthController -->|"monitors"| healthWebRole
        healthCloud -->|"deploys"| healthWebRole
    end
    repo --> healthController

    %% Leader Election Sample
    subgraph "Leader Election Sample"
        leaderMutex["BlobDistributedMutex"]:::shared
        leaderLease["BlobLeaseManager"]:::shared
        leaderWorker["Leader Worker Role"]:::worker
        leaderMutex -->|"manages"| leaderWorker
        leaderLease -->|"coordinates"| leaderWorker
    end
    repo --> leaderMutex

    %% Pipes and Filters Sample
    subgraph "Pipes and Filters Sample"
        pipeSender["Initial Sender"]:::worker
        pipeFilterA["Pipe Filter A"]:::service
        pipeFilterB["Pipe Filter B"]:::service
        pipeReceiver["Final Receiver"]:::worker
        pipeShared["Shared Utilities"]:::shared
        pipeSender -->|"sends"| pipeFilterA
        pipeFilterA -->|"processes"| pipeFilterB
        pipeFilterB -->|"outputs"| pipeReceiver
        pipeSender -->|"uses"| pipeShared
        pipeReceiver -->|"uses"| pipeShared
    end
    repo --> pipeSender

    %% Priority Queue Sample (Service Fabric version)
    subgraph "Priority Queue Sample (Service Fabric)"
        pqSFApp["Service Fabric App"]:::service
        pqSFHigh["High Messages Processor"]:::worker
        pqSFLow["Low Messages Processor"]:::worker
        pqSFShared["Shared Library"]:::shared
        pqSFApp -->|"deploys"| pqSFHigh
        pqSFApp -->|"deploys"| pqSFLow
        pqSFHigh -->|"utilizes"| pqSFShared
        pqSFLow -->|"utilizes"| pqSFShared
    end
    repo --> pqSFApp

    %% Priority Queue Sample (non-Service Fabric)
    subgraph "Priority Queue Sample (non-SF)"
        pqHigh["High Priority Worker"]:::worker
        pqLow["Low Priority Worker"]:::worker
        pqSender["Priority Sender"]:::worker
        pqShared["Shared Library"]:::shared
        pqSender -->|"sends"| pqHigh
        pqSender -->|"sends"| pqLow
        pqHigh -->|"uses"| pqShared
        pqLow -->|"uses"| pqShared
    end
    repo --> pqSender

    %% Static Content Hosting Sample
    subgraph "Static Content Hosting Sample"
        staticCloud["Cloud Deployment"]:::config
        staticWeb["Web Application"]:::web
        staticCloud -->|"configures"| staticWeb
    end
    repo --> staticCloud

    %% Valet Key Security Sample
    subgraph "Valet Key Security Sample"
        valetClient["Client Application"]:::worker
        valetCloud["Cloud Deployment"]:::config
        valetWeb["Web Application"]:::web
        valetClient -->|"authenticates"| valetCloud
        valetCloud -->|"secures"| valetWeb
    end
    repo --> valetClient

    %% Click Events for Competing Consumers Sample
    click compShared "https://github.com/naveengarla/cloud-design-patterns/blob/master/competing-consumers/CompetingConsumers.Shared/CompetingConsumers.Shared.csproj"
    click compSender "https://github.com/naveengarla/cloud-design-patterns/tree/master/competing-consumers/CompetingConsumers/Sender"
    click compReceiver "https://github.com/naveengarla/cloud-design-patterns/tree/master/competing-consumers/CompetingConsumers/Receiver"

    %% Click Event for Compute Resource Consolidation Sample
    click compResWorker "https://github.com/naveengarla/cloud-design-patterns/blob/master/compute-resource-consolidation/ComputeResourceConsolidation.Worker/WorkerRole.cs"

    %% Click Events for External Configuration Store Sample
    click extConfig "https://github.com/naveengarla/cloud-design-patterns/blob/master/external-configuration-store/ExternalConfigurationStore/ExternalConfigurationStore.Cloud/ExternalConfigurationManager.cs"
    click extCloud1 "https://github.com/naveengarla/cloud-design-patterns/blob/master/external-configuration-store/ExternalConfigurationStore/ServiceConfiguration.Cloud.cscfg"
    click extCloud2 "https://github.com/naveengarla/cloud-design-patterns/blob/master/external-configuration-store/ExternalConfigurationStore/ServiceDefinition.csdef"

    %% Click Events for Health Endpoint Monitoring Sample
    click healthController "https://github.com/naveengarla/cloud-design-patterns/blob/master/health-endpoint-monitoring/HealthEndPointMonitoring.Web/Controllers/HealthCheckController.cs"
    click healthWebRole "https://github.com/naveengarla/cloud-design-patterns/blob/master/health-endpoint-monitoring/HealthEndPointMonitoring.Web/WebRole.cs"
    click healthCloud "https://github.com/naveengarla/cloud-design-patterns/blob/master/health-endpoint-monitoring/HealthEndpointMonitoring.Cloud/ServiceConfiguration.Cloud.cscfg"

    %% Click Events for Leader Election Sample
    click leaderMutex "https://github.com/naveengarla/cloud-design-patterns/blob/master/leader-election/DistributedMutex/BlobDistributedMutex.cs"
    click leaderLease "https://github.com/naveengarla/cloud-design-patterns/blob/master/leader-election/DistributedMutex/BlobLeaseManager.cs"
    click leaderWorker "https://github.com/naveengarla/cloud-design-patterns/blob/master/leader-election/LeaderElection/LeaderElection.Worker/WorkerRole.cs"

    %% Click Events for Pipes and Filters Sample
    click pipeSender "https://github.com/naveengarla/cloud-design-patterns/blob/master/pipes-and-filters/InitialSender/InitialSenderRoleEntry.cs"
    click pipeFilterA "https://github.com/naveengarla/cloud-design-patterns/blob/master/pipes-and-filters/PipeFilterA/PipeFilterARoleEntry.cs"
    click pipeFilterB "https://github.com/naveengarla/cloud-design-patterns/blob/master/pipes-and-filters/PipeFilterB/PipeFilterBRoleEntry.cs"
    click pipeReceiver "https://github.com/naveengarla/cloud-design-patterns/blob/master/pipes-and-filters/FinalReceiver/FinalReceiverRoleEntry.cs"
    click pipeShared "https://github.com/naveengarla/cloud-design-patterns/tree/master/pipes-and-filters/PipesAndFilters.Shared/"

    %% Click Events for Priority Queue Sample (Service Fabric)
    click pqSFApp "https://github.com/naveengarla/cloud-design-patterns/tree/master/priority-queue-sf/PriorityQueue.Fabric/"
    click pqSFHigh "https://github.com/naveengarla/cloud-design-patterns/blob/master/priority-queue-sf/PriorityQueue.High/HighMessagesProcessor.cs"
    click pqSFLow "https://github.com/naveengarla/cloud-design-patterns/blob/master/priority-queue-sf/PriorityQueue.Low/LowMessageProcessor.cs"
    click pqSFShared "https://github.com/naveengarla/cloud-design-patterns/blob/master/priority-queue-sf/PriorityQueue.Shared/QueueManager.cs"

    %% Click Events for Priority Queue Sample (non-Service Fabric)
    click pqHigh "https://github.com/naveengarla/cloud-design-patterns/blob/master/priority-queue/PriorityQueue.High/WorkerRole.cs"
    click pqLow "https://github.com/naveengarla/cloud-design-patterns/blob/master/priority-queue/PriorityQueue.Low/WorkerRole.cs"
    click pqSender "https://github.com/naveengarla/cloud-design-patterns/blob/master/priority-queue/PriorityQueue.Sender/WorkerRole.cs"
    click pqShared "https://github.com/naveengarla/cloud-design-patterns/blob/master/priority-queue/PriorityQueue.Shared/QueueManager.cs"

    %% Click Events for Static Content Hosting Sample
    click staticCloud "https://github.com/naveengarla/cloud-design-patterns/tree/master/static-content-hosting/StaticContentHosting.Cloud/"
    click staticWeb "https://github.com/naveengarla/cloud-design-patterns/tree/master/static-content-hosting/StaticContentHosting.Web/"

    %% Click Events for Valet Key Security Sample
    click valetClient "https://github.com/naveengarla/cloud-design-patterns/blob/master/valet-key/ValetKey.Client/Program.cs"
    click valetCloud "https://github.com/naveengarla/cloud-design-patterns/tree/master/valet-key/ValetKey.Cloud/"
    click valetWeb "https://github.com/naveengarla/cloud-design-patterns/tree/master/valet-key/ValetKey.Web/"

    %% Styles
    classDef repo fill:#B3E5FC,stroke:#0277BD,stroke-width:2px;
    classDef worker fill:#F8BBD0,stroke:#C2185B,stroke-width:2px;
    classDef web fill:#C8E6C9,stroke:#388E3C,stroke-width:2px;
    classDef config fill:#FFF9C4,stroke:#FBC02D,stroke-width:2px;
    classDef shared fill:#D1C4E9,stroke:#512DA8,stroke-width:2px;
    classDef service fill:#FFCCBC,stroke:#D84315,stroke-width:2px;
```
