Interfaces and base classes for messaging and event sourcing