public MonkeyMessageProcessor(MonkeyFactory monkeyFactory, MonkeyHub hub, MonkeyCrmConnector crmConnector,
                                      MonkeyEventStore eventStore, IInfrastructureEnvironment environment)
        {
            Container = monkeyFactory.System.AddContainer(
                name: "Monkey Message Processor",
                description: "Reads incoming messages, checks for alert conditions, stores messages",
                technology: "Azure Function");

            Infrastructure = new FunctionAppService
            {
                Name = "monkey-message-processor-" + environment.Name
            };

            Uses(hub)
            .Over <IoTHubSDK>()
            .InOrderTo("Read incoming messages");

            Uses(crmConnector)
            .Over(crmConnector.Infrastructure.Queue("monkey-alerts"))
            .InOrderTo("Notify the CRM system of production failures");

            Uses(eventStore)
            .Over <Https>()
            .InOrderTo("Store incoming messages");
        }
コード例 #2
0
        public MonkeyFactory(Workspace workspace, IInfrastructureEnvironment environment)
        {
            System = workspace.Model.AddSoftwareSystem(
                Location.Internal,
                "Monkey Factory",
                "Azure cloud based backend for processing data created during production of monkeys");

            KeyVault         = new MonkeyKeyVault(this, environment);
            Hub              = new MonkeyHub(this, environment);
            CrmConnector     = new MonkeyCrmConnector(this, environment);
            EventStore       = new MonkeyEventStore(this, environment);
            UI               = new MonkeyUI(this, EventStore, environment);
            MessageProcessor = new MonkeyMessageProcessor(this, Hub, CrmConnector, EventStore, environment);
            DPS              = new MonkeyDeviceProvisioningService(this, Hub, environment);

            TechnicalSupportUser = workspace.Model.AddPerson("Technical support user", "Responds to incidents during monkey production");
            TechnicalSupportUser.Uses(UI, "Gather information about system failures");

            ProductionShiftLead = workspace.Model.AddPerson("Production Shift leader", "Monitors monkey production");
            ProductionShiftLead.Uses(UI, "Monitor load on production systems");

            MonkeyProductionLine = workspace.Model.AddSoftwareSystem(Location.External, "Production Line", "Produces the actual monkeys");
            MonkeyProductionLine.Uses(Hub, "Send production telemetry data and failure events", "MQTT");
            MonkeyProductionLine.Uses(DPS, "Provision device that produces monkeys", "HTTPS");

            Crm = workspace.Model.AddSoftwareSystem(Location.External, "CRM", "");
            Crm.Uses(CrmConnector, "Process failure events in order to create support tickets", "AMQP");

            StoreSecretsInKeyVault();
        }