main.cs2685 chars89 lines
To use this code, create a new QueueProcessor
instance and pass in the connection string to your SQL Server instance and the name of the queue you want to process. Then call the StartAsync
method, passing in a function that will be called for each message in the queue. The message will be passed to the function as a string. The QueueProcessor
class will handle locking and deleting the message from the queue after it has been successfully processed. If the function throws an exception, the message will be unlocked and returned to the head of the queue.
gistlibby LogSnag