JMS Topic Publish/Subscriber
<p>Currently I have started to work on JMS Topic with <strong>ActiveMQ</strong>. I have <strong>created Publisher and Durable Subscribers</strong> through JAVA code (mentioned below) and I received the messages in subscribers side also. </p>

<p><strong>Publisher.Java</strong></p>

<pre><code>public static void createConnectionAndSendMessage(String ipAddress)
    {
        try
        {
            ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://"+ipAddress+":61617");

            Connection connection = factory.createConnection();
            connection.start();

            Session topicSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            Topic topic = topicSession.createTopic("Test-Topic");

            MessageProducer producer = topicSession.createProducer(topic);
            producer.setDeliveryMode(DeliveryMode.PERSISTENT);

            ObjectMessage message = topicSession.createObjectMessage();

            TopicTO topicTO = new TopicTO();
            topicTO.setId(i);
            topicTO.setName("Sample");

            message.setStringProperty("s_id", "Sample");
            message.setObject((Serializable) topicTO);                

            producer.send(message);
            System.out.println("message sent successfully");
        }
    }
    catch(JMSException e)
    {
        System.out.println("error :" + e);
    }
}
</code></pre>

<p><strong>Subscriber.java</strong></p>

<pre><code>public void createConnectionAndReceiveMessage(String clientId, String ipAddress)
    {
        try
        {
            ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://"+ipAddress+":61617");
            Connection connection = connectionFactory.createConnection();
            connection.setClientID(clientId);
            connection.start();            
            Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            Topic topic = session.createTopic("Test-Topic");

            String selector = "s_id = 'Sample'";
            System.out.println("selector : '"+selector+"'....");
            TopicSubscriber consumer = session.createDurableSubscriber(topic, "Sub1", selector, true);

            consumer.setMessageListener(new TopicMessageListener());            

    }
    catch(Exception e)
    {
        System.out.println("error :" + e);
    }
}
</code></pre>

<p>I have some doubts in Topic those are follows,</p>

<p>How may I check that <strong>how many subscribers actively</strong> looking for a message in Topic using Java JMS? </p>

<p>How can I get those active durable subscribers list from Topic?</p>

<p>Do we have any option to delete a posted message in Topic?</p>

<p>Help me in these contexts.<br/>
Thanks in advance.</p>