@Override
  public boolean queueQuery(String queueName) throws Exception {
    boolean queryResult = false;

    QueueQueryResult queueQuery =
        serverSession.executeQueueQuery(SimpleString.toSimpleString(queueName));

    if (queueQuery.isExists()) {
      queryResult = true;
    } else {
      if (queueQuery.isAutoCreateJmsQueues()) {
        serverSession.createQueue(
            new SimpleString(queueName), new SimpleString(queueName), null, false, true);
        queryResult = true;
      } else {
        queryResult = false;
      }
    }

    return queryResult;
  }
  public void init() throws Exception {
    AMQServerSession coreSession = session.getCoreSession();

    SimpleString selector =
        info.getSelector() == null ? null : new SimpleString(info.getSelector());

    nativeId = session.getCoreServer().getStorageManager().generateID();

    SimpleString address = new SimpleString(this.actualDest.getPhysicalName());

    if (this.actualDest.isTopic()) {
      String physicalName = this.actualDest.getPhysicalName();
      if (physicalName.contains(".>")) {
        // wildcard
        physicalName = OpenWireUtil.convertWildcard(physicalName);
      }

      // on recreate we don't need to create queues
      address = new SimpleString("jms.topic." + physicalName);
      if (info.isDurable()) {
        subQueueName =
            new SimpleString(
                ActiveMQDestination.createQueueNameForDurableSubscription(
                    true, info.getClientId(), info.getSubscriptionName()));

        QueueQueryResult result = coreSession.executeQueueQuery(subQueueName);
        if (result.isExists()) {
          // Already exists
          if (result.getConsumerCount() > 0) {
            throw new IllegalStateException(
                "Cannot create a subscriber on the durable subscription since it already has subscriber(s)");
          }

          SimpleString oldFilterString = result.getFilterString();

          boolean selectorChanged =
              selector == null && oldFilterString != null
                  || oldFilterString == null && selector != null
                  || oldFilterString != null
                      && selector != null
                      && !oldFilterString.equals(selector);

          SimpleString oldTopicName = result.getAddress();

          boolean topicChanged = !oldTopicName.equals(address);

          if (selectorChanged || topicChanged) {
            // Delete the old durable sub
            coreSession.deleteQueue(subQueueName);

            // Create the new one
            coreSession.createQueue(address, subQueueName, selector, false, true);
          }

        } else {
          coreSession.createQueue(address, subQueueName, selector, false, true);
        }
      } else {
        subQueueName = new SimpleString(UUID.randomUUID().toString());

        coreSession.createQueue(address, subQueueName, selector, true, false);
      }

      coreSession.createConsumer(nativeId, subQueueName, null, info.isBrowser(), false, -1);
    } else {
      SimpleString queueName = new SimpleString("jms.queue." + this.actualDest.getPhysicalName());
      coreSession.createConsumer(nativeId, queueName, selector, info.isBrowser(), false, -1);
    }

    if (info.isBrowser()) {
      AMQServerConsumer coreConsumer = coreSession.getConsumer(nativeId);
      coreConsumer.setBrowserListener(this);
    }
  }