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); } }
if (!message.isExists())
public MessageProducer createProducer(final Destination destination) throws JMSException { if (destination != null && !(destination instanceof HornetQDestination)) { throw new InvalidDestinationException("Not a HornetQ Destination:" + destination); } try { HornetQDestination jbd = (HornetQDestination)destination; if (jbd != null) { BindingQuery response = session.bindingQuery(jbd.getSimpleAddress()); if (!response.isExists()) { throw new InvalidDestinationException("Destination " + jbd.getName() + " does not exist"); } } ClientProducer producer = session.createProducer(jbd == null ? null : jbd.getSimpleAddress()); return new HornetQMessageProducer(connection, producer, jbd, session); } catch (HornetQException e) { throw JMSExceptionHelper.convertFromHornetQException(e); } }
private HornetQTopic lookupTopic(final String topicName, final boolean isTemporary) throws HornetQException { HornetQTopic topic; if (isTemporary) { topic = HornetQDestination.createTemporaryTopic(topicName); } else { topic = HornetQDestination.createTopic(topicName); } BindingQuery query = session.bindingQuery(topic.getSimpleAddress()); if (!query.isExists()) { return null; } else { return topic; } }