DEV Community

The Sharp Ninja
The Sharp Ninja

Posted on • Updated on

Persistable Work Queue for .Net 5

Persistable Work Queue for .Net 5

GitHub Repo for PersistentWorkQueue

Have you ever needed to guarantee that some piece of data is delivered from point A to point B? Some like a log entry with vital details about a failure? Often we push such log entries to an aggregator or write them to a database. But what if that fails, too?

What you need is a persistent work queue. The work queue will doggedly try to deliver the payload until it succeeds. It also has events for creation of the wrapper around your data which has the metadata about delivery, an event to tell you when the wrapper's state has changed, and an event to let you know when delivery is completed. The wrapper can self-serialize to JSON and also deserializes from JSON, allowing you to easily store the wrapper in local storage until it is successfully delivered.

Take a look and let me know what you think. The unit tests exercise all functionality.

Edit 10/26/2021: The library and tests have been updated to support .Net Standard 2.0.

Discussion (0)