I recently tried to use ActiveMQ with MySQL as the persistent storage.  I can
configure those two to work with each other and I can see the 3 tables in
the `activemq' database, ACTIVEMQ_ACKS, ACTIVEMQ_LOCK, ACTIVEMQ_MSGS. 
However, I noticed that the behavior of delayed messages are unexpected. 

When I set the ScheduledMessage.AMQ_SCHEDULED_DELAY to 60000 (60 seconds),
after I send the message, I expect the message to appear somewhere in MySQL
database so that it is "persistent".  And if I open the admin console
(:8161) I should see an enqueued message in the queue. 

However, the actual behavior is, the message doesn't appear in the
ACTIVEMQ_MSGS table in MySQL database *until* 60 seconds later.  This seems
to tell me that even if I set MySQL database as the persistent storage,
delayed messages (when the time does not come yet) are NOT persistent in the
MySQL database. 

I did some research and it seems that even if I configure MySQL as the
persistent storage, ACTIVEMQ still use file based KahaDB internally.  Can
someone tell me if this is the case, and is there a way to use MySQL to
store the delayed message? 

The snippets of my activemq.xml are: 

<persistenceAdapter>
  <jdbcPersistenceAdapter dataDirectory="${activemq.base}/data"
dataSource="#mysql-ds"/>
</persistenceAdapter>


<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/activemq?relaxAutoCommit=true"/>
  <property name="username" value="activemq"/>
  <property name="password" value="activemq"/>
</bean>

Thanks!



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

Reply via email to