Conceptually, I have the following objects:
Item - (ItemId, Name, Color)
ItemGroup = (GroupId, Name, Item list)
Let's pretend items can belong to multiple groups and that Item identity and the ItemActor is necessary.
For stateful actors, I have this:
ItemActor (ItemId) : Get() -> returns ItemContract { ItemId, Name, Color }
ItemGroupActor (GroupId) : Get() -> returns GroupContract { GroupId, Name, List< ItemContract > }
Here's the questions:
-
Should the GroupActor only keep the ItemIds, and force someone else to call each ItemActor (in a loop) for the ItemContracts?
-
Or does the GroupActor keep all of the item details and listen for Item change events to keep his data up to date (like a view)?
-
Or is there a third "ViewActor" who compiles the data together, calling ItemActors (in a loop), and listening to events to keep it's data up to date?
-
Or something else?
None of these options strike me as particularly attractive, because they either require looping actor calls, or high maintenance item management via events.
Is there some guideline to reassure me one way or the other or for a general approach to this scenario?
Aucun commentaire:
Enregistrer un commentaire