Combining event sourcing and stateful systems
You should take a look at Microsoft&#x27;s Durable Functions which pairs event sourcing + (optional) actor model + serverless. It&#x27;s some pretty neat tech.<p>I tried doing something similar to this several years ago, and here&#x27;s a few issues I ran into:<p>1. Pub&#x2F;sub in Event Sourcing is a bad idea. It&#x27;s really hard to get right. (what to do if sub happens after pub due to scaling issues&#x2F;infrastructure, etc?) Instead it&#x27;s better to push commands deliberately to a process manager that handles the inter-domain communication and orchestration.<p>2. Concurrency. Ensuring aggregates are essentially single-threaded entities is a must. Having the same aggregate id running in multiple places can cause some really fun bugs. This usually requires a distributed lock of some sort.<p>3. Error handling. I ended up never sending a command to a domain directly, instead I sent it to a process manager that could handle all the potential failure cases.