rebus-org / Rebus.SqlServer

:bus: Microsoft SQL Server transport and persistence for Rebus
https://mookid.dk/category/rebus
Other
43 stars 42 forks source link

[Question] Deleteing audits past threshold #68

Closed macchmie3 closed 4 years ago

macchmie3 commented 4 years ago

Is there any way to automatically clean up audit messages? I specify auditing with following method when configuring rebus:

options.EnableMessageAuditing("audit-queue-name");

My problem is that I run a process to browse some audit messages. I only care about the most recent one, and all past, let's say 7-14 days is obsolete to me and I would like to have it removed. Of course I know that I can clean up audits by myself, but I'm wondering about built-in ways :)

mookid8000 commented 4 years ago

Unfortunately, there's no built-in way to do this.

And in most cases, it's not even possible, because most queueing systems don't have an API that can filter messages like that.

One way of using the "forward audited messages to a specific queue" is to create a Rebus endpoint, which will save the messages into a database – this way, audited messages can be cleaned up in any way you like.

Rebus' transport message forwarding capability is a great way to do that, because it's a pretty slim and performant way of processing raw messages.