activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Song <daveson...@gmail.com>
Subject Messages are blocked in queue when using JDBC Master/Slave
Date Fri, 14 Dec 2007 11:23:05 GMT

Hi,there

I have a question when using JDBC Master/Slave. Some of the messages that
have sent to queue are not consumed by messageListener


I used ActiveMQ with spring. It worked perfect with one broker. the beans
configuration is like:


	<bean id="twoBrokersTestJmsTemplate"
		class="org.springframework.jms.core.JmsTemplate">
		<property name="defaultDestinationName"
			value="ActiveMQ.In.twoBrokersTest" />
		<property name="connectionFactory">
			<ref bean="twoBrokersTestJmsFactory" />
		</property>
	</bean>

	<bean id="twoBrokersTestJmsFactory"
		class="org.apache.activemq.pool.PooledConnectionFactory">
		<property name="connectionFactory">
			<bean
				class="org.apache.activemq.ActiveMQConnectionFactory">
				 <property name="brokerURL"
					value="tcp://192.168.1.102:61616"/>
			</bean>
		</property>
	</bean>

	<bean name="twoBrokersTestQueueListener"
		class="activemqTest.twoBrokers.TwoBrokersTestListener">	     
	</bean>

	<bean id="twoBrokersTestQueueListenerContainer"
		class="org.springframework.jms.listener.DefaultMessageListenerContainer">
		<property name="concurrentConsumers" value="5" />
		<property name="connectionFactory" ref="twoBrokersTestJmsFactory" />
		<property name="destinationName" value="ActiveMQ.In.twoBrokersTest" />
		<property name="messageListener" ref="twoBrokersTestQueueListener" />
		<property name="sessionAcknowledgeModeName"
			value="CLIENT_ACKNOWLEDGE" />
		<property name="sessionTransacted" value="true" />
	</bean> 


To made it work more reliable, i tried to use JDBC Master/Slave cluster. I
changed the brokerURL to:

	
	failover:(tcp://192.168.1.102:61616,tcp://192.168.1.236:61616)

And start two brokers in different PC. I configurate both of the
activemq.xml to use the jdbcPersistenceAdapter, like below:

 	<persistenceAdapter>
		<jdbcPersistenceAdapter dataSource="#mssql-ds" useDatabaseLock="false"/>
	</persistenceAdapter>

The DB I used is SQLServer 2000. So I have to set useDatabaseLock to false
or else there will be an exception.


Then I sent some messages to queue with an interval. the problem is some of
the messages would not be consumed by the
messageListenr(twoBrokersTestQueueListener) if the interval is more than 30
seconds. That is to say, it work fine if i sent the messages every 20 (or
any interval <= 29) seconds.


The only related constant I konw whose default value is set to 30 seconds is
"MaxInactivityDuration". I have tried to configurate
"wireFormat.maxInactivityDuration=0" in both client and broker to disable
it. However, I didn't work.

It is very strange that “interval” makes the listeners not working as
expected. 

Any help/suggestions would be appreciated

Thank you in advance, 

Dave
-- 
View this message in context: http://www.nabble.com/Messages-are-blocked-in-queue-when-using-JDBC-Master-Slave-tp14334149s2354p14334149.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message