public void deleteQueue(SimpleString queueName) throws Exception { manager.getServer().destroyQueue(queueName); }
public void deleteQueue(SimpleString queueName) throws Exception { manager.getServer().destroyQueue(queueName); }
@Override public void run() { try { server.destroyQueue(QUEUE); } catch (Exception e) { e.printStackTrace(); } } };
@Override public Response processRemoveSubscription(RemoveSubscriptionInfo subInfo) throws Exception { SimpleString subQueueName = org.apache.activemq.artemis.jms.client.ActiveMQDestination.createQueueNameForSubscription(true, subInfo.getClientId(), subInfo.getSubscriptionName()); server.destroyQueue(subQueueName); return null; }
private void run() { try { if (logger.isDebugEnabled()) { logger.debug("deleting temporary queue " + bindingName); } try { server.destroyQueue(bindingName, null, false); if (observer != null) { observer.tempQueueDeleted(bindingName); } } catch (ActiveMQException e) { // that's fine.. it can happen due to queue already been deleted logger.debug(e.getMessage(), e); } } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorRemovingTempQueue(e, bindingName); } }
private void doIt() { try { if (logger.isDebugEnabled()) { logger.debug("deleting temporary queue " + queueName); } try { server.destroyQueue(queueName, null, false); } catch (ActiveMQNonExistentQueueException e) { // ignore } catch (ActiveMQException e) { ActiveMQServerLogger.LOGGER.errorOnDeletingQueue(queueName.toString(), e); } } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorRemovingTempQueue(e, queueName); } }
@Override public void destroyQueue(final String name, final boolean removeConsumers, final boolean autoDeleteAddress) throws Exception { checkStarted(); clearIO(); try { SimpleString queueName = new SimpleString(name); server.destroyQueue(queueName, null, !removeConsumers, removeConsumers, autoDeleteAddress); } finally { blockOnIO(); } }
@Override public void deleteQueue(final SimpleString queueToDelete) throws Exception { final SimpleString unPrefixedQueueName = removePrefix(queueToDelete); Binding binding = postOffice.getBinding(unPrefixedQueueName); if (binding == null || binding.getType() != BindingType.LOCAL_QUEUE) { throw new ActiveMQNonExistentQueueException(); } server.destroyQueue(unPrefixedQueueName, this, true); TempQueueCleanerUpper cleaner = this.tempQueueCleannerUppers.remove(unPrefixedQueueName); if (cleaner != null) { remotingConnection.removeCloseListener(cleaner); remotingConnection.removeFailureListener(cleaner); } }
/** {@inheritDoc} */ @Override public synchronized void stop(StopContext context) { try { final ActiveMQServer server = this.activeMQServer.getValue(); server.destroyQueue(new SimpleString(queueConfiguration.getName()), null, false); } catch(Exception e) { MessagingLogger.ROOT_LOGGER.failedToDestroy("queue", queueConfiguration.getName()); } }
@Override public synchronized boolean destroyQueue(final String name, final boolean removeConsumers) throws Exception { checkInitialised(); server.destroyQueue(SimpleString.toSimpleString(name), null, !removeConsumers, removeConsumers); // if the queue has consumers and 'removeConsumers' is false then the queue won't actually be removed // therefore only remove the queue from Bindings, etc. if the queue is actually removed if (this.server.getPostOffice().getBinding(SimpleString.toSimpleString(name)) == null) { removeFromBindings(queues, queueBindings, name); queues.remove(name); queueBindings.remove(name); storage.deleteDestination(PersistedType.Queue, name); sendNotification(JMSNotificationType.QUEUE_DESTROYED, name); return true; } else { return false; } }
/** {@inheritDoc} */ @Override public synchronized void stop(StopContext context) { try { final ActiveMQServer server = this.activeMQServer.getValue(); server.destroyQueue(new SimpleString(queueConfiguration.getName()), null, false); } catch(Exception e) { MessagingLogger.ROOT_LOGGER.failedToDestroy("queue", queueConfiguration.getName()); } }
@Test public void testDestroyQueue() throws Exception { conn = cf.createConnection(); conn.start(); Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); sess.createProducer(queue); conn.close(); server.destroyQueue(new SimpleString(queue.getQueueName())); verifier.validatePluginMethodsEquals(2, BEFORE_ADD_ADDRESS, AFTER_ADD_ADDRESS); verifier.validatePluginMethodsEquals(1, BEFORE_CREATE_QUEUE, AFTER_CREATE_QUEUE, BEFORE_DESTROY_QUEUE, AFTER_DESTROY_QUEUE, BEFORE_REMOVE_BINDING, AFTER_REMOVE_BINDING); }
SimpleString coreQ = iterQueues.next(); try { this.server.destroyQueue(coreQ, null, false, true); } catch (ActiveMQNonExistentQueueException idontcare) {
server.destroyQueue(SimpleString.toSimpleString(queueName), null, !removeConsumers, removeConsumers, true);
@Test public void testCreateQueueNotification() throws Exception { JMSUtil.JMXListener listener = new JMSUtil.JMXListener(); this.mbeanServer.addNotificationListener(ObjectNameBuilder.DEFAULT.getActiveMQServerObjectName(), listener, null, null); SimpleString testQueueName = new SimpleString("newQueue"); String testQueueName2 = "newQueue2"; this.server.createQueue(testQueueName, RoutingType.MULTICAST, testQueueName, null, durable, false); Notification notif = listener.getNotification(); System.out.println("got notif: " + notif); assertEquals(CoreNotificationType.BINDING_ADDED.toString(), notif.getType()); this.server.destroyQueue(testQueueName); notif = listener.getNotification(); System.out.println("got notif: " + notif); assertEquals(CoreNotificationType.BINDING_REMOVED.toString(), notif.getType()); ActiveMQServerControl control = ManagementControlHelper.createActiveMQServerControl(mbeanServer); control.createQueue(testQueueName2, testQueueName2, RoutingType.MULTICAST.toString()); notif = listener.getNotification(); System.out.println("got notif: " + notif); assertEquals(CoreNotificationType.BINDING_ADDED.toString(), notif.getType()); control.destroyQueue(testQueueName2); notif = listener.getNotification(); System.out.println("got notif: " + notif); assertEquals(CoreNotificationType.BINDING_REMOVED.toString(), notif.getType()); }
server.destroyQueue(queueName, null, true, false, settings.isAutoDeleteAddresses(), true); } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorRemovingAutoCreatedQueue(e, queueName);
public void removeDestination(ActiveMQDestination dest) throws Exception { if (dest.isQueue()) { try { server.destroyQueue(new SimpleString(dest.getPhysicalName()), getRemotingConnection()); } catch (ActiveMQNonExistentQueueException neq) { //this is ok, ActiveMQ 5 allows this and will actually do it quite often ActiveMQServerLogger.LOGGER.debug("queue never existed"); } } else { Bindings bindings = server.getPostOffice().lookupBindingsForAddress(new SimpleString(dest.getPhysicalName())); if (bindings != null) { for (Binding binding : bindings.getBindings()) { Queue b = (Queue) binding.getBindable(); if (b.getConsumerCount() > 0) { throw new Exception("Destination still has an active subscription: " + dest.getPhysicalName()); } if (b.isDurable()) { throw new Exception("Destination still has durable subscription: " + dest.getPhysicalName()); } b.deleteQueue(); } } } if (!AdvisorySupport.isAdvisoryTopic(dest)) { AMQConnectionContext context = getContext(); DestinationInfo advInfo = new DestinationInfo(context.getConnectionId(), DestinationInfo.REMOVE_OPERATION_TYPE, dest); ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(dest); protocolManager.fireAdvisory(context, topic, advInfo); } }
@Test(timeout = 60000) public void testLinkDetachSentWhenQueueDeleted() throws Exception { AmqpClient client = createAmqpClient(); AmqpConnection connection = addConnection(client.connect()); try { AmqpSession session = connection.createSession(); AmqpReceiver receiver = session.createReceiver(getQueueName()); server.destroyQueue(new SimpleString(getQueueName()), null, false, true); Wait.assertTrue("Receiver should have closed", receiver::isClosed); } finally { connection.close(); } }
server.destroyQueue(queueName, null, true, false, settings.isAutoDeleteAddresses(), true); } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorRemovingAutoCreatedQueue(e, queueName);
@Test public void testRestartWithTXPrepareDeletedQueue() throws Exception { ClientSession clientSession2 = sessionFactory.createSession(false, true, true); ClientProducer clientProducer = clientSession2.createProducer(atestq); ClientMessage m1 = createTextMessage(clientSession2, "m1"); clientProducer.send(m1); Xid xid = newXID(); clientSession.start(xid, XAResource.TMNOFLAGS); clientSession.start(); ClientConsumer clientConsumer = clientSession.createConsumer(atestq); ClientMessage message = clientConsumer.receive(5000); message.acknowledge(); clientSession.end(xid, XAResource.TMSUCCESS); clientSession.prepare(xid); clientSession.getSessionFactory().getConnection().destroy(); messagingService.destroyQueue(atestq); messagingService.stop(); messagingService.start(); messagingService.waitForActivation(10, TimeUnit.SECONDS); assertTrue(messagingService.isStarted()); }