I couldn’t dig up the Java code I wrote at my last client for this, but here are the steps - more info in the BrokerJavaAdmin API documentation:
create a new BrokerAdminClient
you’ll get back a BrokerLockedClientQueueBrowser
For deleteEvents, you have to specify the sequence numbers for the events. You can get that by using BrokerClientQueueBrowser.getEvents(). Once you have the events, loop over them and call BrokerLockedClientQueueBrowser.deleteEvents() for the current seqn #.
You may have to repeat the whole thing several times to truly clear the queue, since getEvents() doesn’t always return all of them (even if you specify the max events input to be extremely high).
There may be a more elegant programmatic solution, but this works. I’ll dig a little more for the code - if I find it I will post.