Storing history in an Actor Model

Being a complete noob to the actor model way of doing things, I a struggling to understand how I would store transaction history in an Actor Model. In the example from ProtoActor Persistence (https://github.com/AsynkronIT/protoactor-dotnet/blob/dev/examples/Persistence/Persistence/Program.cs) the child actor produces a bunch of random names like this: public Task ReceiveAsync(IContext context) { switch(context.Message) { case Started _: context.Self.Tell(new LoopParentMessage()); break; case LoopParentMessage msg: Task.Run(async () => { context.Parent.Tell(new RenameCommand { Name = GeneratePronounceableName(5) }); await Task.Delay(TimeSpan.FromSeconds(2)); context.Self.Tell(new LoopParentMessage()); }); break; } return Actor.Done; } And the parent then updates it's state like this: private async Task Handle(RenameCommand message) { Console.WriteLine("MyPersistenceActor - RenameCommand"); _state.Name = message.Name; await _persistence.PersistEventAsync(new RenameEvent { Name = message.Name }); } The question is, in an actor model, how should I store and retrieve a list of the previously generated names to display to the user. Do I just store them in a separate database table? That seems a bit wasteful because I have already stored the events in the Event Store. So then should I use the Event Store as the journal? That also feels like I am mixing concerns of the events. Another way of asking this: If I have a bank account modeled as an actor, how should I store the transaction history so that I can show it in the UI and not just the current balance?

May 10, 2025 - 11:09
 0

Being a complete noob to the actor model way of doing things, I a struggling to understand how I would store transaction history in an Actor Model. In the example from ProtoActor Persistence (https://github.com/AsynkronIT/protoactor-dotnet/blob/dev/examples/Persistence/Persistence/Program.cs) the child actor produces a bunch of random names like this:

public Task ReceiveAsync(IContext context)
{
    switch(context.Message)
    {
        case Started _:
            context.Self.Tell(new LoopParentMessage());
            break;
        case LoopParentMessage msg:
            Task.Run(async () => {
                context.Parent.Tell(new RenameCommand { Name = GeneratePronounceableName(5) });
                await Task.Delay(TimeSpan.FromSeconds(2));
                context.Self.Tell(new LoopParentMessage());
            });
            break;
    }

    return Actor.Done;
}

And the parent then updates it's state like this:

private async Task Handle(RenameCommand message)
{
    Console.WriteLine("MyPersistenceActor - RenameCommand");
    _state.Name = message.Name;
    await _persistence.PersistEventAsync(new RenameEvent { Name = message.Name });
}

The question is, in an actor model, how should I store and retrieve a list of the previously generated names to display to the user.

Do I just store them in a separate database table? That seems a bit wasteful because I have already stored the events in the Event Store. So then should I use the Event Store as the journal? That also feels like I am mixing concerns of the events.

Another way of asking this: If I have a bank account modeled as an actor, how should I store the transaction history so that I can show it in the UI and not just the current balance?