How Troolio works
Troolio helps you represent a business action as a command, record its outcome as an event, and answer questions from state rebuilt from those events. It runs on Microsoft Orleans actors. You can start with one actor and add projections or provider adapters as your application grows.
On this page
One actor, four ideas
- A command asks an actor to do something, such as
Increment. - A handler checks the request and decides what happened.
- An event records that fact, such as
Incremented. The event stream is the write history. - A query reads current state. On activation, the actor can rebuild that state by replaying its events.
In the first actor, these two methods make the relationship concrete:
public IEnumerable<Event> Handle(Increment command) =>
[new Incremented(command.Headers)];
public void On(Incremented _) => count++;
The first method decides an event; the second applies it to state. Keep On free of network or provider calls so replay is safe.
What readers and outside systems see
A projection consumes committed events to build a read model. It can lag behind the command result. An external action, such as a reminder or notification, needs a durable effect intent and a provider that deduplicates retries.
Projections and external effects explain the two paths.
Choose a command path
For a first app, learn the ordinary actor path and configure a suitable store. For an operation whose participants, projection handoffs, and completion evidence must commit together, explicitly select the atomic command route. That route requires a compatible store, current route authority, and recovery plan; a package reference does not activate it.
Where to go next
- Model a command and rule with an accepted and rejected outcome.
- Build the first actor, then configure the host.
- Explore events and state, stores, and read models.
- For advanced routes, follow atomic commit, route authority, and recovery.
Continue into an application
Follow the workshop workflow to connect two actors, orchestration, a SQL projection, and an authorized reader. Learn message metadata to understand correlation, causation, user, device, message, and transaction IDs.