How to clean up Broker Queues

Hi all,

We are facing a problem where there are lot of Broker Documents got published. When we are publishing other documents it says not enough space. So, we need to clean up Broker Queue. We work remotely. So, Is there any way that we can clean it by using any service in Developer.

Pls help.

Thanks in advance,


What version are you on? There are ways to do it via the MWS broker admin console (in 7.1) or via a Java service written using the Broker API.


I should qualify this by saying that your problem (not enough space) can likely be solved by adding another Broker data file or tuning your pub-sub integrations, rather than clearing out a queue.

I suspect that there is a client queue defined that is more or less dead–no client ever pulls from it. So once it is cleared, it will start filling up again and you’ll hit the same problem in the future. You may want to investigate that.

Hi Phil,

We are on 6.1. I don’t have any authorization for tuning pub-sub integrations but I’ll try to ask that but meanwhile is there any way to clean the queue?


Hi Reamon,

What I have found is that, There is a error handling service which is publishing the error documents on the Broker. I think there is no one to subscribe them. I do not deal with those packages.So, I just want to clean the queue…Yeah, you are right. It will fill up again. Can you pls suggest how to clean up the queue.?


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
call BrokerAdminClient.createLockedClientQueueBrowser()
you’ll get back a BrokerLockedClientQueueBrowser
call BrokerLockedClientQueueBrowser.deleteEvents()

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.

Hi Phil,

Thanks for your response. I’ll try doing that but if you can find the code pls post it.