public void delete() throws JMSException { if (session != null) { if (session.getCoreSession().isClosed()) { // Temporary queues will be deleted when the connection is closed.. nothing to be done then! return; } if (isQueue()) { session.deleteTemporaryQueue(this); } else { session.deleteTemporaryTopic(this); } } }
@Override public TopicSubscriber createDurableSubscriber(final Topic topic, final String name, String messageSelector, final boolean noLocal) throws JMSException { // As per spec. section 4.11 if (sessionType == ActiveMQSession.TYPE_QUEUE_SESSION) { throw new IllegalStateException("Cannot create a durable subscriber on a QueueSession"); } checkTopic(topic); if (!(topic instanceof ActiveMQDestination)) { throw new InvalidDestinationException("Not an ActiveMQTopic:" + topic); } if ("".equals(messageSelector)) { messageSelector = null; } ActiveMQDestination jbdest = (ActiveMQDestination) topic; if (jbdest.isQueue()) { throw new InvalidDestinationException("Cannot create a subscriber on a queue"); } return createConsumer(jbdest, name, messageSelector, noLocal, ConsumerDurability.DURABLE); }
try { if (dest.isQueue()) {
if (destination.isQueue() && query.isAutoCreateQueues()) { clientSession.createAddress(address, RoutingType.ANYCAST, true); if (destination.isTemporary()) { createQueue(destination, RoutingType.ANYCAST, address, null, true, true, query.getDefaultMaxConsumers(), query.isDefaultPurgeOnNoConsumers(), query.isDefaultExclusive(), query.isDefaultLastValueQueue()); } else if (!destination.isQueue() && query.isAutoCreateAddresses()) { clientSession.createAddress(address, RoutingType.MULTICAST, true); } else if ((destination.isQueue() && !query.isAutoCreateQueues()) || (!destination.isQueue() && !query.isAutoCreateAddresses())) { throw new InvalidDestinationException("Destination " + address + " does not exist"); if (queueQuery.isExists()) { connection.addKnownDestination(address); } else if (destination.isQueue() && query.isAutoCreateQueues()) { if (destination.isTemporary()) { clientSession.createTemporaryQueue(address, RoutingType.ANYCAST, address); coreMessage.putStringProperty(ActiveMQConnection.CONNECTION_ID_PROPERTY_NAME, connID); coreMessage.setRoutingType(destination.isQueue() ? RoutingType.ANYCAST : RoutingType.MULTICAST);
if (!activeMQDestination.isQueue()) { throw new InvalidDestinationException("Cannot create a browser on a topic");
if (dest.isQueue()) { AddressQuery response = session.addressQuery(dest.getSimpleAddress());
public void delete() throws JMSException { if (session != null) { if (session.getCoreSession().isClosed()) { // Temporary queues will be deleted when the connection is closed.. nothing to be done then! return; } if (isQueue()) { session.deleteTemporaryQueue(this); } else { session.deleteTemporaryTopic(this); } } }
public void delete() throws JMSException { if (session != null) { /** * The status of the session used to create the temporary destination is uncertain, but the JMS spec states * that the lifetime of the temporary destination is tied to the connection so even if the originating * session is closed the temporary destination should still be deleted. Therefore, just create a new one * and close it after the temporary destination is deleted. This is necessary because the Core API is * predicated on having a Core ClientSession which is encapsulated by the JMS session implementation. */ try (ActiveMQSession sessionToUse = (ActiveMQSession) session.getConnection().createSession()) { if (isQueue()) { sessionToUse.deleteTemporaryQueue(this); } else { sessionToUse.deleteTemporaryTopic(this); } } } }
public void delete() throws JMSException { if (session != null) { /** * The status of the session used to create the temporary destination is uncertain, but the JMS spec states * that the lifetime of the temporary destination is tied to the connection so even if the originating * session is closed the temporary destination should still be deleted. Therefore, just create a new one * and close it after the temporary destination is deleted. This is necessary because the Core API is * predicated on having a Core ClientSession which is encapsulated by the JMS session implementation. */ try (ActiveMQSession sessionToUse = (ActiveMQSession) session.getConnection().createSession()) { if (isQueue()) { sessionToUse.deleteTemporaryQueue(this); } else { sessionToUse.deleteTemporaryTopic(this); } } } }
public void delete() throws JMSException { if (session != null) { /** * The status of the session used to create the temporary destination is uncertain, but the JMS spec states * that the lifetime of the temporary destination is tied to the connection so even if the originating * session is closed the temporary destination should still be deleted. Therefore, just create a new one * and close it after the temporary destination is deleted. This is necessary because the Core API is * predicated on having a Core ClientSession which is encapsulated by the JMS session implementation. */ try (ActiveMQSession sessionToUse = (ActiveMQSession) session.getConnection().createSession()) { if (isQueue()) { sessionToUse.deleteTemporaryQueue(this); } else { sessionToUse.deleteTemporaryTopic(this); } } } }
@Override public TopicSubscriber createDurableSubscriber(final Topic topic, final String name, String messageSelector, final boolean noLocal) throws JMSException { // As per spec. section 4.11 if (sessionType == ActiveMQSession.TYPE_QUEUE_SESSION) { throw new IllegalStateException("Cannot create a durable subscriber on a QueueSession"); } checkTopic(topic); if (!(topic instanceof ActiveMQDestination)) { throw new InvalidDestinationException("Not an ActiveMQTopic:" + topic); } if ("".equals(messageSelector)) { messageSelector = null; } ActiveMQDestination jbdest = (ActiveMQDestination) topic; if (jbdest.isQueue()) { throw new InvalidDestinationException("Cannot create a subscriber on a queue"); } return createConsumer(jbdest, name, messageSelector, noLocal, ConsumerDurability.DURABLE); }
@Override public TopicSubscriber createDurableSubscriber(final Topic topic, final String name, String messageSelector, final boolean noLocal) throws JMSException { // As per spec. section 4.11 if (sessionType == ActiveMQSession.TYPE_QUEUE_SESSION) { throw new IllegalStateException("Cannot create a durable subscriber on a QueueSession"); } checkTopic(topic); if (!(topic instanceof ActiveMQDestination)) { throw new InvalidDestinationException("Not an ActiveMQTopic:" + topic); } if ("".equals(messageSelector)) { messageSelector = null; } ActiveMQDestination jbdest = (ActiveMQDestination) topic; if (jbdest.isQueue()) { throw new InvalidDestinationException("Cannot create a subscriber on a queue"); } return createConsumer(jbdest, name, messageSelector, noLocal, ConsumerDurability.DURABLE); }
@Override public TopicSubscriber createDurableSubscriber(final Topic topic, final String name, String messageSelector, final boolean noLocal) throws JMSException { // As per spec. section 4.11 if (sessionType == ActiveMQSession.TYPE_QUEUE_SESSION) { throw new IllegalStateException("Cannot create a durable subscriber on a QueueSession"); } checkTopic(topic); if (!(topic instanceof ActiveMQDestination)) { throw new InvalidDestinationException("Not an ActiveMQTopic:" + topic); } if ("".equals(messageSelector)) { messageSelector = null; } ActiveMQDestination jbdest = (ActiveMQDestination) topic; if (jbdest.isQueue()) { throw new InvalidDestinationException("Cannot create a subscriber on a queue"); } return createConsumer(jbdest, name, messageSelector, noLocal, ConsumerDurability.DURABLE); }
@Override public TopicSubscriber createDurableSubscriber(final Topic topic, final String name, String messageSelector, final boolean noLocal) throws JMSException { // As per spec. section 4.11 if (sessionType == ActiveMQSession.TYPE_QUEUE_SESSION) { throw new IllegalStateException("Cannot create a durable subscriber on a QueueSession"); } checkTopic(topic); if (!(topic instanceof ActiveMQDestination)) { throw new InvalidDestinationException("Not an ActiveMQTopic:" + topic); } if ("".equals(messageSelector)) { messageSelector = null; } ActiveMQDestination jbdest = (ActiveMQDestination) topic; if (jbdest.isQueue()) { throw new InvalidDestinationException("Cannot create a subscriber on a queue"); } return createConsumer(jbdest, name, messageSelector, noLocal, ConsumerDurability.DURABLE); }