Durable Topic Subscription - Messages not getting persisted in database

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Durable Topic Subscription - Messages not getting persisted in database

I am not able to get the messages saved in database for a topic with an
offline durable subscriber. Because of this, if I restart the activemq, the
messages in the topic are lost (not delivered to durable subscriber), where
as the:
    1.  message expiry time has not yet reached
    2.  and durable subscription still exists
    3.  and the subscriber successfully reconnects.

*ActiveMQ Version :  5.13.1*

I checked the database table activemq_msgs after stopping activemq, the
table was empty. Additionally, I noted that the table activemq_acks contains
the entry for my durable subscription. Now I restarted activemq, it does not
shows any message in the topic (from web ui), but shows that the durable
subscription exists.

I am testing the scenario where a durable subscriber is both online and
offline, activemq gets restarted and the messages are not delivered to
durable subscriber. I tested this by sending 10000 messages in the topic and
before all get consumed, i stopped and restarted the activemq, I also
monitored the db table activemq_msgs, where not a single row got inserted
when I sent the messages

*Test Scenario#1 : Steps*
     >. create a durable subscriber
     >. send 10,000 messages to the topic (using activemq web admin ui)
     >. No rows in activemq_msgs table (but web admin shows the messages are
enqueued in topic)
     >. activemq_acks table contains one row which shows the durable
subscription details
     >. restart the broker
     >. durable subscriber reconnects and does not get any message.
     >. web admin also shows zero messages in topic, but the durable still
subscriber exists with status as
         active durable subscription.

*Test Scenario#2  : Steps*
     >. create a durable subscriber
     >. stop it
     >. send messages to the topic
     >. verify messages on mysql table
     >. mysql table is empty (but web admin shows the messages are enqueued
in topic)
     >. connect the durable subscriber to consume messages
     >. All enqueued messages are dequeued to durable subscriber
     >. mysql table is still empty.

*Configuration is as follows:*

<broker xmlns="http://activemq.apache.org/schema/core"
brokerName="Central-Dev-Broker" persistent="true"
offlineDurableSubscriberTaskSchedule="3000" useJmx="true">
                <policyEntry topic=">" >
                        <constantPendingMessageLimitStrategy limit="1000"/>

                <policyEntry queue=">">
                        <individualDeadLetterStrategy queuePrefix="DLQ."

        <managementContext createConnector="false"/>
        <jdbcPersistenceAdapter dataSource="#mysql-ds"/>
                <memoryUsage percentOfJvmHeap="70" />
                <storeUsage limit="100 gb"/>
                <tempUsage limit="50 gb"/>
        <transportConnector name="openwire"
        <transportConnector name="amqp"
        <bean xmlns="http://www.springframework.org/schema/beans"
class="org.apache.activemq.hooks.SpringContextHook" />

<bean id="mysql-ds" class="org.apache.commons.dbcp2.BasicDataSource"
    <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
    <property name="url"
    <property name="username" value="root"/>
    <property name="password" value="root"/>
    <property name="poolPreparedStatements" value="true"/>
<import resource="jetty.xml"/>

Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html