void deleteQueue(final SimpleString queueName) throws JMSException { if (!session.isClosed()) { try { session.deleteQueue(queueName); } catch (HornetQException ignore) { // Exception on deleting queue shouldn't prevent close from completing } } }
/** * Closes the ClientRequestor and its session. * * @throws Exception if an exception occurs while closing the ClientRequestor */ public void close() throws Exception { replyConsumer.close(); queueSession.deleteQueue(replyQueue); queueSession.close(); }
/** * Closes the ClientRequestor and its session. * * @throws Exception if an exception occurs while closing the ClientRequestor */ public void close() throws Exception { replyConsumer.close(); requestProducer.close(); queueSession.deleteQueue(replyQueue); }
@Override public void stop() throws Exception { shutdown.set(true); if (session != null) session.close(); ClientSession coreSession = sf.createSession(false, false, false); coreSession.deleteQueue(QUEUE_EXAMPLE_QUEUE); coreSession.close(); }
private void deleteSubscriberQueue(PushConsumer consumer) { String subscriptionName = consumer.getDestination(); ClientSession session = null; try { session = sessionFactory.createSession(); session.deleteQueue(subscriptionName); } catch (HornetQException e) { } finally { closeSession(session); } } }
private void deleteSubscriberQueue(QueueConsumer consumer) { String subscriptionName = consumer.getId(); ClientSession session = null; try { session = sessionFactory.createSession(); session.deleteQueue(subscriptionName); } catch (HornetQException e) { } finally { if (session != null) { try { session.close(); } catch (HornetQException e) { } } } } }
@DELETE public void deleteTopic(@Context UriInfo uriInfo) throws Exception { HornetQRestLogger.LOGGER.debug("Handling DELETE request for \"" + uriInfo.getPath() + "\""); topicDestinationsResource.getTopics().remove(destination); try { stop(); } catch (Exception ignored) { } ClientSession session = serviceManager.getSessionFactory().createSession(false, false, false); try { SimpleString topicName = new SimpleString(destination); session.deleteQueue(topicName); } finally { try { session.close(); } catch (Exception ignored) { } } }
initialSession.deleteQueue(queueName);
@DELETE public void deleteQueue(@Context UriInfo uriInfo) throws Exception { HornetQRestLogger.LOGGER.debug("Handling DELETE request for \"" + uriInfo.getPath() + "\""); queueDestinationsResource.getQueues().remove(destination); stop(); ClientSession session = serviceManager.getSessionFactory().createSession(false, false, false); try { SimpleString queueName = new SimpleString(destination); session.deleteQueue(queueName); } finally { try { session.close(); } catch (Exception ignored) { } } }
protected void deleteSubscriberQueue() { String subscriptionName = registration.getDestination(); ClientSession session = null; try { session = factory.createSession(); session.deleteQueue(subscriptionName); } catch (HornetQException e) { HornetQRestLogger.LOGGER.errorDeletingSubscriberQueue(e); } finally { try { if (session != null) session.close(); } catch (HornetQException e) { } } } }
/** * creates IOFog message queues, {@link ClientMessage} producer * and {@link ClientSession} * * @throws Exception */ void initialize() throws Exception { synchronized (messageBusSessionLock) { messageBusSession = sf.createSession(true, true, 0); QueueQuery queueQuery = messageBusSession.queueQuery(new SimpleString(Constants.ADDRESS)); if (queueQuery.isExists()) messageBusSession.deleteQueue(Constants.ADDRESS); queueQuery = messageBusSession.queueQuery(new SimpleString(Constants.COMMAND_LINE_ADDRESS)); if (queueQuery.isExists()) messageBusSession.deleteQueue(Constants.COMMAND_LINE_ADDRESS); messageBusSession.createQueue(Constants.ADDRESS, Constants.ADDRESS, false); messageBusSession.createQueue(Constants.COMMAND_LINE_ADDRESS, Constants.COMMAND_LINE_ADDRESS, false); commandlineProducer = messageBusSession.createProducer(Constants.COMMAND_LINE_ADDRESS); commandlineConsumer = messageBusSession.createConsumer(Constants.COMMAND_LINE_ADDRESS, String.format("receiver = '%s'", "iofog.commandline.command")); commandlineConsumer.setMessageHandler(new CommandLineHandler()); messageBusSession.start(); } }
public void deleteTemporaryTopic(final HornetQDestination tempTopic) throws JMSException { if (!tempTopic.isTemporary()) { throw new InvalidDestinationException("Not a temporary topic " + tempTopic); } try { BindingQuery response = session.bindingQuery(tempTopic.getSimpleAddress()); if (!response.isExists()) { throw new InvalidDestinationException("Cannot delete temporary topic " + tempTopic.getName() + " does not exist"); } if (response.getQueueNames().size() > 1) { throw new IllegalStateException("Cannot delete temporary topic " + tempTopic.getName() + " since it has subscribers"); } SimpleString address = tempTopic.getSimpleAddress(); session.deleteQueue(address); connection.removeTemporaryQueue(address); } catch (HornetQException e) { throw JMSExceptionHelper.convertFromHornetQException(e); } }
public void unsubscribe(final String name) throws JMSException { // As per spec. section 4.11 if (sessionType == HornetQSession.TYPE_QUEUE_SESSION) { throw new IllegalStateException("Cannot unsubscribe using a QueueSession"); } SimpleString queueName = new SimpleString(HornetQDestination.createQueueNameForDurableSubscription(connection.getClientID(), name)); try { QueueQuery response = session.queueQuery(queueName); if (!response.isExists()) { throw new InvalidDestinationException("Cannot unsubscribe, subscription with name " + name + " does not exist"); } if (response.getConsumerCount() != 0) { throw new IllegalStateException("Cannot unsubscribe durable subscription " + name + " since it has active subscribers"); } session.deleteQueue(queueName); } catch (HornetQException e) { throw JMSExceptionHelper.convertFromHornetQException(e); } }
public void deleteTemporaryQueue(final HornetQDestination tempQueue) throws JMSException { if (!tempQueue.isTemporary()) { throw new InvalidDestinationException("Not a temporary queue " + tempQueue); } try { QueueQuery response = session.queueQuery(tempQueue.getSimpleAddress()); if (!response.isExists()) { throw new InvalidDestinationException("Cannot delete temporary queue " + tempQueue.getName() + " does not exist"); } if (response.getConsumerCount() > 0) { throw new IllegalStateException("Cannot delete temporary queue " + tempQueue.getName() + " since it has subscribers"); } SimpleString address = tempQueue.getSimpleAddress(); session.deleteQueue(address); connection.removeTemporaryQueue(address); } catch (HornetQException e) { throw JMSExceptionHelper.convertFromHornetQException(e); } }
session.deleteQueue(queueName);