Question

I'm using joliver/EventStore library and trying to find a way of how to get a stream not reading any events from it.

The reason is that I want just to write some events into that store for specific stream without loading all 10k messages from it.

Was it helpful?

Solution

The way you're expected to use the store is that you always do a GetById first. Even if you new up an Aggregate and Save it, you'll see in the CommonDomain EventStoreRepository that it will first correlate it with the existing data.

The key reason why a read is needed first is that the infrastructure needs to work out how many events have gone before to compute the new commit sequence number.

Regarding your citing of your example threshold that makes you want to optimize this away... If you're really going to have that level of events, you'll already be into snapshotting territory as you'll need to have an appropriately efficient way of doing things other than blind write too.

Even if you're not intending to lean on snapshotting, half the benefit of using EventStore is that the facility is buitl in for when you need it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top