User bio
404 bio not found
Maine, USA
Member since Feb 18, 2016
Replies:

Also, one might be tempted to simply kill the ^Ens.Queue global.

Don't.

^Ens.Queue is used for other housekeeping tasks, and while killing it will absolutely remove all messages from visibility in the queue viewer, it won't change the message headers for those items from queued status to something else (like aborted or discarded). And it will very likely break other things that you really don't want to break.

Here's a short method you can place in a utility class that does what you want:

ClassMethod AbortAll() As %Status
{
    Set tSC = $$$OK
    Set tQry = ##class(%SQL.Statement).%New()
    Set tSC = tQry.%PrepareClassQuery("Ens.Queue","Enumerate")
    If $$$ISOK(tSC)
    {
        Set tRS = tQry.%Execute()
        While tRS.%Next()
        {
            Set tQueue = tRS.%Get("Name")
            Write !, "Aborting Queue "_tQueue
            Do ##class(Ens.Queue).AbortQueue(tQueue)
        }
    }
    Return tSC
}
Certifications & Credly badges:
Global Masters badges:
Followers:
Following: