We are developing an application that will use Service Broker for message delivery. Everything seems to be working correctly, but during development we experienced multiple instances where messages got stuck in either the transmission or receive queues.
What could be causing this? If they continue to get stuck in the transmission queue during production, do you have any suggestions for preventing and/or clearing the stuck records in this queue? I added the following code to reprocess the transmission queue but
have not gotten any stuck records during testing to verify that the code works.
2. Using End Conversation With CleanUp will immediately removes all messages from the service queue and the transmission queue.If you want to clear all messages in all the queues in a database,then you can try to use ALTER DATABASE ... SET NEW_BROKER WITH
The following thread is about similar requirement, please refer to: