I am using .NET RabbitMQ Client
library. I want to develop a messaging system.
For this, I have implemented all necessary methods of RabbitMQ. Moreover I have developed dispose()
for deleting queue. I am calling this method in FormClosing
event so this method will be triggered when user closes the application by clicking on close button and by the logic queue will be deleted. Up to this, all code is working perfectly.
But my problem is
I'm not able to delete a queue at the time of closing the application without clicking on close button (let's just say closing application from task manager or from command prompt using taskkill command or any abnormally reasons) as this dispose() will not be triggered. At this time, queue will not be deleted until I delete it from management portal manually.
So my question is,
How can I know that the application is closed and that orphan queue can be deleted?