I'm using CQRS for an application that I'm building (an online discussion system with complex business logic) and I've reached a part in the implementation that worries me.
How should I handle pageviews? If a user views a thread, I want to track that. Because I want to track that, it follows that I should create a command and an event, and tie this into the aggregate root that is responsible for the object that I'm viewing (for example; UserViewsThread and UserViewedThread, respectively). But this seems widely inefficient - as other than this, there is no reason to hit an aggregate root in many of the use cases of a discussion system (viewing forums/threads). Now that I'm introducing this, I will have an additional command dispatch and event publish on every single view of a page, which is in turn responsible for "spooling up" the thread aggregate, serializing my event, and sending it to my event publisher.
There has to be a better way to do this. I was thinking of perhaps making it so that my controller object is capable of dispatching events - but by bypassing my aggregate, I can no longer attach behavior to a pageview.
Another possibility is the idea of using this as a way to authenticate my user. The UserViewsThread and UserViewsForum commands will be allowed to throw an authentication exception to let my controller know that the user cannot perform this action. But if these were to be translated into events, and stored in my event store, we're talking about multiple events created on every page view - which could very well murder performance (every page view results in a database transaction... ugh) and resource management.
What are your guy's thoughts?