| Author |
how do i remove consumers on a queue
|
robert stevens
Greenhorn
Joined: Jul 05, 2007
Posts: 7
|
|
i am dynamically setting up a jms queue which i use to talk across 2 different jvms. Now when i try to delete that queue i get a big fat exception ... the essence of which is as below ERROR [ORB-Worker-7] - Failed to remove destination=aqueue javax.jms.JMSException: Cannot delete destination aqueue-true since there are active consumers. aqueue is the name of the queue that i create. Now i before i remove the queue i do probe the jms to find if it exists as below JMSAdministrator jmsAdministratorInstance = JMSAdministrator.getInstance(); if(jmsAdministratorInstance.queueExists(queueName) on finding that the queue i remove the active consumers by the following Vector<String> consumerVector = new Vector(); try { consumerVector= this.handleToAdminServer.getDurableConsumers(queueName); //assumes no more than 100 consumers.... String[] consumerArray = new String[100]; consumerVector.copyInto(consumerArray); int i=0; while (i< consumerArray.length) { System.out.println("Consumer name :- " + consumerArray[i]); if(this.handleToAdminServer.removeDurableConsumer(consumerArray[i])) { System.out.println("Successfully removed consumer " + consumerArray[i]); } if(this.handleToAdminServer.unregisterConsumer(consumerArray[i])) { System.out.println("Successfully deactivated " + consumerArray[i]); } i++; } } catch (JMSException e) { // TODO Auto-generated catch block e.printStackTrace(); return false; } after having removed the consumers i go ahead to remove the queue by the following try { this.handleToAdminServer.removeDestination(queueName); this.listOfAactiveQueues.remove(queueName); } catch (JMSException e) { // TODO Auto-generated catch block e.printStackTrace(); } now my program runs properly but the openjms (which i have opened in a linux terminal) throws the excetption which i have mentioned on top. Now i am a totally novice in the area. Can anyone please help me out.
|
 |
robert stevens
Greenhorn
Joined: Jul 05, 2007
Posts: 7
|
|
|
problem solved \m/
|
 |
Scott Selikoff
Saloon Keeper
Joined: Oct 23, 2005
Posts: 3652
|
|
|
Why not share your solution so others with a similar problem might benefit?
|
My Blog: Down Home Country Coding with Scott Selikoff
|
 |
 |
|
|
subject: how do i remove consumers on a queue
|
|
|