Long operation on entity


(Pawel) #1

How do you handle a long operation (read side DB query) in persistent entity if the client should know the outcome?


(Tim Moore) #2

The short answer is that you shouldn’t perform a long operation from a persistent entity.

A persistent entity command handler is like a database transaction. It needs to be fast and deterministic, producing the same results consistently when processing a given command and state.

Instead, have whatever is sending the command to the persistent entity perform the query first and then put the results into the command object.