For some reason I naievely thougth that deleting and recreating a projection would solve a problem I had in my application. Now I have two problems…
The projection intends to project from a large stream of events (“hub”) to a per-aggregate instance stream. The original projection was not created with “track emitted”
so “delete emitted” would not have helped even if I had known about it. Regardless, I am now in a state where I cannot recreate the projection. Or rather, I am in a
state that I cannot enable the recreated projection.
I would like to follow this advice to attempt to DELETE the created streams that were created by the projection. However I am unable to easily list all streams that exist…
I wrote a script to try and list all streams from $streams, but that appears to lists all events from all streams and after deleting a page of streams, I now appear to have events that are
orphaned (they are listed in $streams, they have a streamId, but that stream does not exist). Perhaps they will disappear if I scavange?
Based on an off-the-cuff comment mentioned in one of the various posts that I have read, I seem to believe that the “Multiple projections…detected”
error message arrises because the projection checks the head event on a target stream and compare a projection ID and raises that message.
- If I was able to publish an event to a stream with a projectionId that matches the projection, will that trick the validation logic for enabling the projection? What shape should
that event take. (although I will still have to deal with the issue to list all streams)
- How can I see what projection a given stream/event is associated with - I cannot see anything in the “rich” JSON of a stream. Likewise I am unable
to see any projectionId in metadata about the projection
Is there was a way I can change the projectionId of my new projection to a desired value?
Is there an easier way to list all streams than iterating over all the events in $streams? I have several orders of magnitude less streams that events, so processing
each event seems excessive
- In deleting a stream, should I soft delete or hard delete? (The hard delete documentation indicates that the stream cannot be recreated and indeed that it does not get
scavenged - is that a mistake?). Will soft delete be enough given that the events aren’t deleted?
- Is there a better way to fix the mess I have got myself into?