$maxAge does not work for me

Hello Community!

I set $maxAge metadata property on existing stream, but existing old events which > $maxAge are not marked as deleted (at least I can’t see any flag on the standard EventStore web UI).
What’s even weirder - when I run scavenge - it reclaims disk space.
But I still can view JSON body of the old events.
That events are linked in another stream - could this be the reason?
EventStoreDb version = 20.6.0.

Thanks for help.

They are likely being cached by your browser. What happens when you disable caching from developer tools?

Eventually I wrote a little utility that just dumps events from the stream to file. It allowed me to see that the retention settings work (yes, they do). Clicking on Stream Browser is a bit of a hassle, especially the “last” button shows a blank page instead of the last event (I disabled the cache). Thanks for the help.

Hi Team,

I have configured MaxAge & MaxCount in Metadata but still events are not mark as deleted.

Data
{
  "AggregateVersion": 0,
  "AggregateId": "9c8f8b1b-5d81-4b73-995e-41f46571bc75",
  "When": "2024-02-07T06:05:32.229972+00:00"
}
				
Metadata
{
  "MaxCount": 0,
  "MaxAge": "00:0:10",
  "CausationId": "9c8f8b1b-5d81-4b73-995e-41f46571bc75",
  "CorrelationId": "9c8f8b1b-5d81-4b73-995e-41f46571bc75",
  "EventType": "TestEvent"
}

Please help me to fix this.

Have you written the metadata to the event or the stream?

$maxCount & $maxAge is stream metadata ( with the $ !) and not event metadata.

SetStreamMetadataAsync ( .net client, there are equivalents in the other clients) will help you set those more easily .

causation & correlation should be $correlationId & $causationId ( if you want to use the built-in feature of ESDB ) and is event metadata

@yves.lorphelin @yves.lorphelin sorry it was my mistake, I was writing in EventMeta. Will check with StreamMeta and update you shortly !!

1 Like