Partitioning streams question

Hi all, I’m still getting my head around streams and whatnot, but I cannot work out the best solution to this problem:

We have a bunch of events with an “external id” - this could be used as a key to partition the stream into many other streams.

There is a special event, which has the “external id” property as well as the “internal id” property (which is produced after a process of matching external data with internal data - always a one to one mapping).

No other events have the “internal id”.

What I would like, is to be able to get (in a stream) all the events that relate to the “internal id”, even before the special event with the “internal id was added”. So for example:

6: GoalScored { ExternalId: 1 }

5: IdMatchSuccessfully { ExternalId: 1, InternalId: 123 }

4: GoalScored { ExternalId: 1 }

3: GoalScored { ExternalId: 2 }

2: GameStarted { ExternalId: 2 }

1: GameStarted { ExternalId: 1 }

I would like to get a stream that would return, for InternalId = 123 the following:

6: GoalScored { ExternalId: 1 }

5: IdMatchSuccessfully { ExternalId: 1, InternalId: 123 }

4: GoalScored { ExternalId: 1 }

1: GameStarted { ExternalId: 1 }

Is this possible? Do I achieve this by using links to other streams?

Cheers,

Chris

This would not be possible as you would have to go back in time on the stream for the first one. Projections work in a forward feed model. That said you could make it work relatively easily for some small fixed number by holding them in state (say last 5 then issue linktos of previous when you get the match)

Chris,

From the example below (accepting it might be more involved), could you not just repartition based on external ID, and then when you get the internal ID add an entry to an external map which you use to derive the name of the correct stream to read?

Cheers,

James