# What all happens when a command is invoked?

When a non-event sourced command is invoked:

  1. pre-conditions are validated
  2. command code is executed
  3. output returned to the caller (for synchronous calls)

When an event sourced command is invoked:

  1. pre-conditions are validated
  2. command code is executed
  3. event(s) raised
    1. i.e. saved in event-stream
    2. event counter is updated
  4. write-handler gets executed
  5. event gets published onto the event bus
  6. event stable number gets updated
  7. output returned to the caller (for synchronous calls)

Note: post condition gets executed at the end only in test-cases