Skip to content

Instantly share code, notes, and snippets.

@andreasohlund
Created October 9, 2012 08:01
Show Gist options
  • Select an option

  • Save andreasohlund/3857269 to your computer and use it in GitHub Desktop.

Select an option

Save andreasohlund/3857269 to your computer and use it in GitHub Desktop.
How to clear the NServiceBus inMemory gateway persister periodically
public class DeduplicationCleanup : IWantToRunWhenTheBusStarts
{
public InMemoryPersistence MemoryPersistence { get; set; }
public void Run()
{
Schedule.Every(TimeSpan.FromMinutes(1))
//delete all ID's older than 30 minutes
.Action(()=> MemoryPersistence.DeleteDeliveredMessages(DateTime.UtcNow.AddMinutes(-30)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment