title: How can I subscribe to an activemq topic with just read rights?
body: <p>I have been trying to configure my activemq server so that anonymous clients can just subscribe to topics (they would not be able to create nor publish to topics).</p>
  
  <p>I've set the rights accordingly on my broker configuration:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;plugins&gt;
      &lt;simpleAuthenticationPlugin anonymousAccessAllowed="true"&gt;
          &lt;users&gt;
              &lt;authenticationUser username="system" password="manager"
                  groups="anonymous,admins"/&gt;
          &lt;/users&gt;
      &lt;/simpleAuthenticationPlugin&gt;
  
  
    &lt;!--  Lets configure a destination based authorization mechanism --&gt;
    &lt;authorizationPlugin&gt;
      &lt;map&gt;
        &lt;authorizationMap&gt;
          &lt;authorizationEntries&gt;
            &lt;authorizationEntry queue="&gt;" read="admins,anonymous" write="admins" admin="admins" /&gt;
  
            &lt;authorizationEntry topic="&gt;" read="admins,anonymous"  write="admins" admin="admins" /&gt;
  
          &lt;/authorizationEntries&gt;
        &lt;/authorizationMap&gt;
      &lt;/map&gt;
    &lt;/authorizationPlugin&gt;
  
  &lt;/plugins&gt;
  </code></pre>
  
  <p>and I have been using code below for subscribing based on a couple of tutorials I found on the web. However this topic consumer code, and all the ones I've found, creates an activemq topic to bind to (event if the topic already exists) and as a consequence it will only be authorized if I give admin rights to the user as well... <strong>Is there a way to subscribe to the topic without creating it?</strong></p>
  
  <pre class="lang-java prettyprint-override"><code>     ActiveMQSslConnectionFactory connectionFactory = new ActiveMQSslConnectionFactory(connectionString);
       connection = connectionFactory.createConnection();
       session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
       destination = session.createTopic(topicName);
       MessageConsumer consumer = null;
       consumer = session.createConsumer(destination);
       consumer.setMessageListener(this);
       connection.start();
  </code></pre>