Write to same stream from multiple projections, or maxAge?

Hello,

I have events about Transactions that are first Received, then Confirmed, the Received event types can be removed after 7 days to save storage space, the Confirmed needs to stay forever.

To implement this I have two streams:

  • TxRecv $maxAge: 7 days
  • TxConf
    Both of these write to Streams through a Projection:

fromStream(‘TxRecv’)
.when({
$any: function(s, ev) {
linkTo(ev.metadata.address, ev)
}
})

fromStream(‘TxConf’)
.when({
$any: function(s, ev) {
linkTo(ev.metadata.address, ev)
}
})

``

This means I can subscribe to one Stream, the Address from the metadata to receive all events about Transactions to the Address.

However when I attempt to run this, I get the following: The ‘’ projection faulted due to ‘Multiple projections emitting to the same stream detected.’

I’m not sure why this would be an issue, as I can write to the same Stream with many different EventStore clients.

If I cannot do this, can I set a $maxAge on an individual EventData for it to be removed the from the system after the 7 day timeline?

Many thanks for any assistance.

James

Multiple projections cannot write to the same stream due as they would
conflict with each other (and it would be impossible to reset a
projection). That said if you are willing to give up the latter we are
introducing a "run with scissors" mode that would allow you to do just
this.

Thanks Greg - As usual when explaining a problem, I have resolved it two minutes after.

I am able to use the fromStreams function in a projection to collate the two streams together. Thank you for thinking of this case.

https://geteventstore.com/blog/20130210/the-cost-of-creating-a-stream/