"2. Probably not, if I assume that every implementation of an
eventstore has headers. In the .net world, yours and Jon Olivers are
the only eventstores I'm aware of. Thinking about it now, even if I
encountered an eventstore that didn't support it, I could just wrap it
in my own envelope type before saving. But the other side of that
question, is the command handler really the place to be looking up the
IP, grabbing the process ID, username, etc. to be stored in those
headers, or do you usually put that code elsewhere?"
You can wrap a composite pretty easily to track this kind of stuff.
myDomainObject.UncommittedEvents = myDomainObject.UncommittedEvents.WithMetadata(myCommand.Metadata);
myRepository.Add(myDomainObject);
Where the first line creates copies of the uncommitted events, but now decorated with the metadata from the commands.
However, it seems wrong that one has to remember to write this line of code, though I can't think of anywhere else in the code where we have access to both the events and the command.