Assets domain implementation
This page describes how the Assets domain model is realized at runtime: event-sourcing/CQRS mechanics, storage topology, projections, APIs, integrations, and code references. The generic V3 event-sourcing pattern it builds on is documented in Data and events; this page covers only the asset-specific specifics.
Runtime topology
The assets bounded context is an event-sourced write model with state-based CQRS read models. Aggregates replay their streams and append pending events against the loaded stream version. SQL projection rows carry an event-store ETag for idempotency.
See event sourcing, event model, and event store for the shared V3 patterns.
Storage topology
Cosmos event store
| Container | Partitioning | Streams |
|---|---|---|
asset_ingestions | /partition_id; customer short | Asset and import-set streams |
classifications | /partition_id; constant classifications | Classification streams |
leases | /id | Change Feed processor leases |
AssetAggregate is partitioned by customer short; ImportSetAggregate uses the
customer short parsed from its import-set stream ID; ClassificationAggregate uses
the fixed classifications partition. The infrastructure definition is
boundedctx-assets/infrastructure-store/main-db-cosmos.tf. Repository adapters append
with optimistic stream versions in
boundedctx-assets/app/src/Ontinue.Ion.Application.BoundedCtx.Assets/Repositories/.
SQL projections
| Table | Purpose |
|---|---|
ion_asset | Current asset state and deletion suggestion flag |
ion_import_set | Current import progress and outcome counters |
ion_asset_classification | Current classification and watchlist configuration |
asset_change_log | Created, updated, skipped, failed, and deleted audit rows |
The SQL IonAsset, IonImportSet, IonClassification, and Changelog records are
projection entities, not children of the aggregates.
OperationalProjectionSubscriberFunc consumes published events and
OperationalProjectionService updates these tables, using SQL transactions where
an event changes both a projection and its change log.
Read API
The implemented HTTP API is query-only and reads SQL projections.
| Method and route | Result |
|---|---|
GET /v1/ion-asset-classifications | All classifications |
GET /v1/customers/{customer-short}/ion-import-sets | Filtered, paged import sets |
GET /v1/customers/{customer-short}/ion-import-sets/latest-per-automation-run | Latest import per automation run |
GET /v1/customers/{customer-short}/ion-assets | Filtered, paged assets |
GET /v1/customers/{customer-short}/ion-assets/{ion-asset-id} | One asset |
GET /v1/customers/{customer-short}/changelogs | Filtered, paged asset history |
Writes enter through Service Bus commands, not HTTP endpoints. See
boundedctx-assets/app/src/Ontinue.Ion.Functions.BoundedCtx.AssetsHttp/OperationalApiFunc.cs.
Contracts and schemas
Canonical CloudEvent type strings and schema paths for commands are in
boundedctx-assets/app/src/Ontinue.Ion.Contracts.BoundedCtx.Assets/AssetContractsConstants.cs
and boundedctx-assets/api/v1/commands/. Event contracts are implemented in
boundedctx-assets/app/src/Ontinue.Ion.Contracts.BoundedCtx.Assets/v1/Events/
and mirrored by JSON schemas in boundedctx-assets/api/v1/events/.
Validation is implemented in
boundedctx-assets/app/src/Ontinue.Ion.Contracts.BoundedCtx.Assets/Validators/AssetImportRecordValidator.cs.
Classification configuration invariants are in
boundedctx-assets/app/src/Ontinue.Ion.Contracts.BoundedCtx.Assets/Validators/IonClassificationValidator.cs.
The asset value structure is implemented in
boundedctx-assets/app/src/Ontinue.Ion.Core.BoundedCtx.Assets/EventStore/AssetAggregate.cs
and
boundedctx-assets/app/src/Ontinue.Ion.Contracts.BoundedCtx.Assets/v1/Data/IonAssetData.cs.
Integrations
| Flow | Implementation | External dependencies |
|---|---|---|
| Dataset ingestion | boundedctx-assets/app/src/Ontinue.Ion.Application.BoundedCtx.Assets/Services/IngestionService.cs | File imports read Azure Blob Storage; automation imports use the configured automation data source |
| Automation | boundedctx-assets/app/src/Ontinue.Ion.Application.BoundedCtx.Assets/Services/AutomationService.cs | Live customers from Doppio, Key Assets configuration, enabled automations from Themis |
| Sentinel watchlist sync | boundedctx-assets/app/src/Ontinue.Ion.Application.BoundedCtx.Assets/Services/WatchlistSyncService.cs and WatchlistOperationService.cs | Conveyor Archer API and Microsoft Sentinel workspace watchlist |
Implementation evidence
The primary implementation is boundedctx-assets. Key anchors:
boundedctx-assets/app/src/Ontinue.Ion.Core.BoundedCtx.Assets/EventStore/boundedctx-assets/app/src/Ontinue.Ion.Application.BoundedCtx.Assets/Services/boundedctx-assets/app/src/Ontinue.Ion.Database.BoundedCtx.Assets/Tables/boundedctx-assets/api/boundedctx-assets.yamlboundedctx-assets/service-map.json