Automated Compacting Streams #4050
Unanswered
ewilliams0305
asked this question in
Ideas
Replies: 1 comment
-
|
Hey, just trying to keep the issue count lower, so I'm moving this to a discussion. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a use case for some very long lived streams with LOTS of events. (IOT device monitoring application.)
This issue proposes a way to add
IHostedServiceinstances for specific streams indended to compact the streams periodically. Below is a very rough draft of some code I whipped up in our application to accompish this. Should the Marten team feel this is something that is sutable directly intigrated in Marten I'm happy to make a PR referencing this issue.Final API (Usage)
Here we would be saying every day check all streams of type
DeviceStatusfor compacting. If the stream includes events older than 30 days, run the compacting.Compacting Option
Configuration options could include something like this that is used to define how and when this should run.
Hosted Service
Hosted Background Service
The hosted service would look something like this
Register the Hosted Service using the Marten Expression
Beta Was this translation helpful? Give feedback.
All reactions