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

docscaa
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"
offlineDurableSubscriberTimeout="-1"
offlineDurableSubscriberTaskSchedule="3000" useJmx="true">
    <destinationPolicy>
        <policyMap>
            <policyEntries>
                <policyEntry topic=">" >
                    <pendingMessageLimitStrategy>
                        <constantPendingMessageLimitStrategy limit="1000"/>
                    </pendingMessageLimitStrategy>
                </policyEntry>

                <policyEntry queue=">">
                    <deadLetterStrategy>
                        <individualDeadLetterStrategy queuePrefix="DLQ."
useQueueForQueueMessages="true"/>
                    </deadLetterStrategy>
                </policyEntry>

            </policyEntries>
        </policyMap>
    </destinationPolicy>
    <managementContext>
        <managementContext createConnector="false"/>
    </managementContext>
    <persistenceAdapter>
       
        <jdbcPersistenceAdapter dataSource="#mysql-ds"/>
    </persistenceAdapter>
    <systemUsage>
        <systemUsage>
            <memoryUsage>
                <memoryUsage percentOfJvmHeap="70" />
            </memoryUsage>
            <storeUsage>
                <storeUsage limit="100 gb"/>
            </storeUsage>
            <tempUsage>
                <tempUsage limit="50 gb"/>
            </tempUsage>
        </systemUsage>
    </systemUsage>
    <transportConnectors>
        <transportConnector name="openwire"
uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
        <transportConnector name="amqp"
uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
    </transportConnectors>
    <plugins/>
    <shutdownHooks>
        <bean xmlns="http://www.springframework.org/schema/beans"
class="org.apache.activemq.hooks.SpringContextHook" />
    </shutdownHooks>
</broker>


<bean id="mysql-ds" class="org.apache.commons.dbcp2.BasicDataSource"
destroy-method="close">
    <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
    <property name="url"
value="jdbc:mysql://localhost:3306/db_activemq?relaxAutoCommit=true"/>
    <property name="username" value="root"/>
    <property name="password" value="root"/>
    <property name="poolPreparedStatements" value="true"/>
</bean>
<import resource="jetty.xml"/>



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