activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ncsridhar <>
Subject Topic messages lost even when they are persistent - help!
Date Thu, 02 Dec 2010 18:00:12 GMT


I am a new user trying to use activemq for my ESB. I am trying to use the
sample programs TopicPublisher and TopicLIstener. I am posting messages to
ActiveMQ topics  called "topictest.messages" , "topictest.control". I am
marking them as persistent in the following ways:

        ActiveMQConnectionFactory factory = new
        connection = factory.createConnection();
        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        //session = connection.createSession(false,
        topic = session.createTopic("topictest.messages");
        control = session.createTopic("topictest.control");
        publisher = session.createProducer(topic);
>>>>>>>>>> and also when sending the actual message itself >>>>>>>>>
       for (int i = 0; i < messages; i++) {
            publisher.send(msg, DeliveryMode.PERSISTENT, 3, 1);
            if ((i + 1) % 1000 == 0) {
                System.out.println("Sent " + (i + 1) + " messages");

I have created a durable subscriber on the topictest.messages topic. When I
run the publisher program it posts the messages fine and I can verify that,
but they dont survive a restart. I cant see what I am doing wrong. The odd
behavior is that when I put messages on my queues, they survive restarts by
default, but same is not true for the topics. Below is my activemq.xml:


    <!-- Allows us to use system properties as variables in this
configuration file -->
        <property name="locations">

        The <broker> element is used to configure the ActiveMQ broker. 
    <broker xmlns=""
brokerName="localhost" dataDirectory="${activemq.base}/data"
persistent="true" useShutdownHook="false">
			For better performances use VM cursor and small memory limit.
			For more information, see:
            Also, if your producer is "hanging", it's probably due to
producer flow control.
            For more information, see:
                <policyEntry topic=">" producerFlowControl="true"
                    <vmCursor />
                <policyEntry queue=">" producerFlowControl="true"
                  <!-- Use VM cursor for better latency
                       For more information, see:
            The managementContext is used to configure how ActiveMQ is
exposed in 
            JMX. By default, ActiveMQ uses the MBean server that is started
            the JVM. For more information, see: 
            <managementContext createConnector="false"/>

            Configure message persistence for the broker. The default
            mechanism is the KahaDB store (identified by the kahaDB tag). 
            For more information, see: 
            <kahaDB directory="${activemq.base}/data/kahadb"  />
            The systemUsage controls the maximum amount of space the broker
            use before slowing down producers. For more information, see:
                    <memoryUsage limit="20 mb"/>
                    <storeUsage limit="1 gb"/>
                    <tempUsage limit="100 mb"/>
            The transport connectors expose ActiveMQ over a given protocol
            clients and other brokers. For more information, see: 
            <transportConnector name="openwire" uri="tcp://"/>


        Enable web consoles, REST and Ajax APIs and demos
        It also includes Camel (with its web console), see
${ACTIVEMQ_HOME}/conf/camel.xml for more info
        Take a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details 
    <import resource="jetty.xml"/>
    <import resource="camel.xml"/>

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message