@Override public void unsubscribe(final String name) throws JMSException { // As per spec. section 4.11 if (sessionType == ActiveMQSession.TYPE_QUEUE_SESSION) { throw new IllegalStateException("Cannot unsubscribe using a QueueSession"); } SimpleString queueName = ActiveMQDestination.createQueueNameForSubscription(true, 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 (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } }
queueName = ActiveMQDestination.createQueueNameForSubscription(durability == ConsumerDurability.DURABLE, connection.getClientID(), subscriptionName);
queueName = ActiveMQDestination.createQueueNameForSubscription(true, connection.getClientID(), subscriptionName);
private static SimpleString createQueueName(boolean useCoreSubscriptionNaming, String clientId, String pubId, boolean shared, boolean global, boolean isVolatile) { if (useCoreSubscriptionNaming) { final boolean durable = !isVolatile; final String subscriptionName = pubId.contains("|") ? pubId.split("\\|")[0] : pubId; final String clientID = clientId == null || clientId.isEmpty() || global ? null : clientId; return ActiveMQDestination.createQueueNameForSubscription(durable, clientID, subscriptionName); } else { String queue = clientId == null || clientId.isEmpty() || global ? pubId : clientId + "." + pubId; if (shared) { if (queue.contains("|")) { queue = queue.split("\\|")[0]; } if (isVolatile) { queue += ":shared-volatile"; } if (global) { queue += ":global"; } } return SimpleString.toSimpleString(queue); } }
private static SimpleString createQueueName(boolean useCoreSubscriptionNaming, String clientId, String pubId, boolean shared, boolean global, boolean isVolatile) { if (useCoreSubscriptionNaming) { final boolean durable = !isVolatile; final String subscriptionName = pubId.contains("|") ? pubId.split("\\|")[0] : pubId; final String clientID = clientId == null || clientId.isEmpty() || global ? null : clientId; return ActiveMQDestination.createQueueNameForSubscription(durable, clientID, subscriptionName); } else { String queue = clientId == null || clientId.isEmpty() || global ? pubId : clientId + "." + pubId; if (shared) { if (queue.contains("|")) { queue = queue.split("\\|")[0]; } if (isVolatile) { queue += ":shared-volatile"; } if (global) { queue += ":global"; } } return SimpleString.toSimpleString(queue); } }
private long countMessagesForSubscription(String clientID, String subscriptionName, String filterStr, ManagementService managementService) throws Exception { SimpleString queueName = ActiveMQDestination.createQueueNameForSubscription(true, clientID, subscriptionName); QueueControl coreQueueControl = (QueueControl) managementService.getResource(ResourceNames.QUEUE + queueName); if (coreQueueControl == null) { throw new IllegalArgumentException("No subscriptions with name " + queueName + " for clientID " + clientID); } String filter = createFilterFromJMSSelector(filterStr); return coreQueueControl.countMessages(filter); }
private int countMessagesForSubscription(String clientID, String subscriptionName, String filterStr, ManagementService managementService) throws Exception { SimpleString queueName = ActiveMQDestination.createQueueNameForSubscription(true, clientID, subscriptionName); QueueControl coreQueueControl = (QueueControl) managementService.getResource(ResourceNames.QUEUE + queueName); if (coreQueueControl == null) { throw new IllegalArgumentException("No subscriptions with name " + queueName + " for clientID " + clientID); } String filter = createFilterFromJMSSelector(filterStr); return coreQueueControl.listMessages(filter).length; }
@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 dropDurableSubscription(final String clientID, final String subscriptionName, ManagementService managementService) throws Exception { SimpleString queueName = ActiveMQDestination.createQueueNameForSubscription(true, clientID, subscriptionName); QueueControl coreQueueControl = (QueueControl) managementService.getResource(ResourceNames.QUEUE + queueName); if (coreQueueControl == null) { throw new IllegalArgumentException("No subscriptions with name " + queueName + " for clientID " + clientID); } ActiveMQServerControl serverControl = (ActiveMQServerControl) managementService.getResource(ResourceNames.BROKER); serverControl.destroyQueue(queueName.toString(), true); }
private void dropDurableSubscription(final String clientID, final String subscriptionName, ManagementService managementService) throws Exception { SimpleString queueName = ActiveMQDestination.createQueueNameForSubscription(true, clientID, subscriptionName); QueueControl coreQueueControl = (QueueControl) managementService.getResource(ResourceNames.QUEUE + queueName); if (coreQueueControl == null) { throw new IllegalArgumentException("No subscriptions with name " + queueName + " for clientID " + clientID); } ActiveMQServerControl serverControl = (ActiveMQServerControl) managementService.getResource(ResourceNames.BROKER); serverControl.destroyQueue(queueName.toString(), true); }
@Override public void unsubscribe(final String name) throws JMSException { // As per spec. section 4.11 if (sessionType == ActiveMQSession.TYPE_QUEUE_SESSION) { throw new IllegalStateException("Cannot unsubscribe using a QueueSession"); } SimpleString queueName = ActiveMQDestination.createQueueNameForSubscription(true, 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 (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } }
@Override public void unsubscribe(final String name) throws JMSException { // As per spec. section 4.11 if (sessionType == ActiveMQSession.TYPE_QUEUE_SESSION) { throw new IllegalStateException("Cannot unsubscribe using a QueueSession"); } SimpleString queueName = ActiveMQDestination.createQueueNameForSubscription(true, 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 (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } }
@Override public void unsubscribe(final String name) throws JMSException { // As per spec. section 4.11 if (sessionType == ActiveMQSession.TYPE_QUEUE_SESSION) { throw new IllegalStateException("Cannot unsubscribe using a QueueSession"); } SimpleString queueName = ActiveMQDestination.createQueueNameForSubscription(true, 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 (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } }
@Override public void unsubscribe(final String name) throws JMSException { // As per spec. section 4.11 if (sessionType == ActiveMQSession.TYPE_QUEUE_SESSION) { throw new IllegalStateException("Cannot unsubscribe using a QueueSession"); } SimpleString queueName = ActiveMQDestination.createQueueNameForSubscription(true, 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 (ActiveMQException e) { throw JMSExceptionHelper.convertFromActiveMQException(e); } }
queueName = ActiveMQDestination.createQueueNameForSubscription(durability == ConsumerDurability.DURABLE, connection.getClientID(), subscriptionName);
queueName = ActiveMQDestination.createQueueNameForSubscription(durability == ConsumerDurability.DURABLE, connection.getClientID(), subscriptionName);
SimpleString queueName = ActiveMQDestination.createQueueNameForSubscription(true, spec.getClientID(), spec.getSubscriptionName());
queueName = ActiveMQDestination.createQueueNameForSubscription(durability == ConsumerDurability.DURABLE, connection.getClientID(), subscriptionName);
queueName = ActiveMQDestination.createQueueNameForSubscription(durability == ConsumerDurability.DURABLE, connection.getClientID(), subscriptionName);
queueName = org.apache.activemq.artemis.jms.client.ActiveMQDestination.createQueueNameForSubscription(true, clientID, subscriptionName); if (info.getDestination().isComposite()) { queueName = queueName.concat(physicalName);