Anonymous sessions and late linking

Imagine you have a system where you ask questions of a person. Over time you build up a model of that person based on their answers.

Now… there is another way to have an anonymous session… where answers are also collected. Later in that session the user identified themselves, so now you know all the previous events relate to that person.

Do you:

  • have something repost the events against the user stream
  • have some event posted to the user stream referencing the ID of the session
  • something else?

In the end you want the data from both to be a single picture of the person.


Assuming the user already exists on the system?

I would write the events like this to a single stream


Would be easy enough having a projection processing these events, and emitting something off the back QuestionaireHasFinishedEvent showing that a user was identified (and who it was)

I reckon the Questions and User Id would need to belong to the same stream, as I suspect you would want to enforce things like:

  1. user must exist
  2. can’t have more than 1 user identified