The admin namespace does a few important tasks: DatabaseMaintenance, ErrorNotifications, ResourceMonitoring, and Emailer.
Code Repo:
Admin-Scheduler - https://qtraxweb.visualstudio.com/SMC%20Projects/_git/Admin-Scheduler
Admin-Functions - https://qtraxweb.visualstudio.com/SMC%20Projects/_git/Admin-Functions
Admin-DatabaseMaintenance-Functions - https://qtraxweb.visualstudio.com/SMC%20Projects/_git/Admin-DatabaseMaintenance-Functions
Admin-DataFactory - https://qtraxweb.visualstudio.com/SMC%20Projects/_git/Admin-DataFactory (Handles clean up of Admin DB)
Admin-Contract - https://qtraxweb.visualstudio.com/SMC%20Projects/_git/Admin-Contract?path=/Admin-Contract (Stores entities and events)
Admin-DatabaseMaintenance-Commons - https://qtraxweb.visualstudio.com/SMC%20Projects/_git/Admin-DatabaseMaintenance-Commons?path=/DatabaseMaintenance-Commons
Database Maintenance
DatabaseMaintenance run based off of Cron strings that are stored on the Admin DB in the dbo.QRTZ_CRON_TRIGGERS. There is an Admin Scheduler app service that runs and picks the jobs up. Graylogs can be found by searching bundleName: Admin.Scheduler. The first run will be based off the job detail on the dbo.QRTZ_JOB_DETAILS table. Job Data is encrypted so use the attached queries to Select or Insert accordingly. The table dbo.QRTZ_TRIGGERS will keep track of the next run. You can specify whether the run needs to run full maintenance or statistics only and a list of tables to maintain if needed (don't set to run all tables in DB). Currently the connection information for the DB is stored in the table but a KTLO story is being worked on that will migrate those details to KeyVault.
SELECT SCHED_NAME, JOB_NAME, JOB_GROUP, JOB_CLASS_NAME, CONVERT(VARCHAR(MAX), JOB_DATA, 0) FROM [dbo].[QRTZ_JOB_DETAILS] --THESE INSERT ARE JUST EXAMPLES TO SHOW CAPABILITIES insert into [QRTZ_JOB_DETAILS] values ('QuartzScheduler', 'p-datamart-shard0_ReportStatistics', 'Maintenance', null, 'PremiumRetail.Admin.Scheduler.DatabaseMaintenance.Jobs.AzureSqlDatabaseMaintenanceSchedulerJob, PremiumRetail.Admin.Scheduler', 0, 0, 0, 0, convert(varbinary(max), '{"ServerName": "p-datamart1.database.windows.net", "DatabaseName": "p-datamart-shard0", "UserId": "p-datamart", "EncryptedPassword": "KNW77aRVHmmKXbe4YjNS7Plj9D3qXnUfSkmaxy2EvME=", "MaintenanceType": "Statistics", "hasFilteredSubscription": "true", "IsEnabled": "true", "Tables": "[dbo].[WeeklyStoreItemAdjustments];[dbo].[WeeklyStoreItemInventory];[dbo].[WeeklyStoreItemMarkdowns];[dbo].[WeeklyStoreItemRelationship];[dbo].[WeeklyStoreItemSales];[dbo].[WeeklySalesOccurrence];[dbo].[ItemGrouping]"}')); insert into [QRTZ_TRIGGERS] values ('QuartzScheduler', 'p-datamart-shard0_ReportStatistics_Trigger', 'Maintenance_Triggers', 'p-datamart-shard0_ReportStatistics', 'Maintenance', null, 637437287400000000, 637437286800000000, 5, 'ACQUIRED', 'CRON', 637436654470000000, null, null, 2, null); insert into [QRTZ_CRON_TRIGGERS] values ('QuartzScheduler', 'p-datamart-shard0_ReportStatistics_Trigger', 'Maintenance_Triggers', '0 0 4,8,12 ? * SUN-FRI', 'Central Standard Time');
Error Notifications
Each Service Bus Namespaces have error topics and we bridge all errors here. We record the notifications and use them to send emails to the Dev team for research purposes. The bridges will set a sourceSystem constant that is stored in the dbo.ErrorNotificationSourceSystemAssignment table that is referenced in the the dbo.ErrorNotificationConfiguration table. This is tied to the dbo.EmailDistribution table through the DistributionKey and used to send email accordingly.
Resource Monitoring
This is what creates our tickets for Service Bus. Namespaces and connection strings are stored in the dbo.Resource table and thresholds are stored in the dbo.ProcessParameter table. Email distributions for the messages are on the dbo.EmailDistribution table.
Email Distribution Message
Sends email based on message properties sent and will add To, Cc, or Bcc address from the EmailDistribution table if setup.