vendredi 23 septembre 2016

Service Fabric / Actor Pattern for List of Things

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:

  1. Should the GroupActor only keep the ItemIds, and force someone else to call each ItemActor (in a loop) for the ItemContracts?

  2. 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)?

  3. 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?

  4. 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