Subscriptions - AWS SimSpace Weaver

Subscriptions

You create a subscription with a subscription area and a domain ID. The domain ID represents the domain that owns that subscription area. A BoundingBox2F32 describes the subscription area. Use the following function to create a subscription:

Result<SubscriptionHandle> CreateSubscriptionBoundingBox2F32(Transaction& txn, DomainId id, const BoundingBox2F32& boundingBox)
Example
Result<void> CreateSubscriptionInSpatialDomain(Transaction& transaction) { WEAVERRUNTIME_TRY(Api::PartitionSet partitionSet, Api::AllPartitions(transaction)); Api::DomainId spatialDomainId; for (const Api::Partition& partition : partitionSet.partitions) { if (partition.domain_type == Api::DomainType::Spatial) { /** * Get the spatial domain ID. */ spatialDomainId = partition.domain_id; break; } } constexpr Api::BoundingBox2F32 subscriptionBounds { /* min */ { /* x */ 0, /* y */ 0 }, /* max */ { /* x */ 1000, /* y */ 1000 } } WEAVERRUNTIME_TRY( Api::SubscriptionHandle subscriptionHandle, Api::CreateSubscriptionBoundingBox2F32( transaction, spatialDomainId, subscriptionBounds)); return Success(); }

You can use the Api::SubscriptionHandle returned by CreateSubscriptionBoundingBox2F32() to modify the subscription. You pass it as an argument to the following functions:

Result<void> ModifySubscriptionBoundingBox2F32(Transaction& txn, SubscriptionHandle handle, const BoundingBox2F32& boundingBox)
Result<void> DeleteSubscription(Transaction& txn, SubscriptionHandle handle)