翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
登録したエンティティのイベントを繰り返し処理します。
AllSubscriptionEvents()
を使用して、登録済みエンティティ (アプリケーションのサブスクリプション領域にあるエンティティ) のイベントリストを取得します。関数には以下のような署名があります。
Result<SubscriptionChangeList> AllSubscriptionEvents(Transaction& txn)
次に、以下の例に示すように、ループを使用してエンティティを繰り返し処理します。
例
WEAVERRUNTIME_TRY(Api::SubscriptionChangeList subscriptionChangeList, Api::AllSubscriptionEvents(transaction)); for (const Api::SubscriptionEvent& event : subscriptionChangeList.changes) { Api::Entity entity = event.entity; Api::ChangeListAction action = event.action; switch (action) { case Api::ChangeListAction::None: // insert code to handle the event break; case Api::ChangeListAction::Remove: // insert code to handle the event break; case Api::ChangeListAction::Add: // insert code to handle the event break; case Api::ChangeListAction::Update: // insert code to handle the event break; case Api::ChangeListAction::Reject: // insert code to handle the event break; } }
イベントタイプ
None
— エンティティが領域内にあり、その位置とフィールドのデータは変更されていません。Remove
— エンティティが領域から削除されました。Add
— エンティティが領域に追加されました。Update
— エンティティが領域内にあり、変更されました。Reject
— アプリケーションは領域からエンティティを削除できませんでした。
注記
Reject
イベントが発生した場合、アプリケーションは次のティックで転送を再試行します。