activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cristian3001 <cristian.pope...@autodata.net>
Subject Re: Problems with ActiveMQ4.1.1 - Master/Slave brokers
Date Tue, 10 Jun 2008 15:27:44 GMT

Hi Venkatesh,


The master:

<beans>
	<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
/>
	<broker brokerName="localhost" useJmx="true"
xmlns="http://activemq.org/config/1.0">
		<destinationPolicy>
			<policyMap>
				<policyEntries>
					<policyEntry topic="FOO.>">
						<dispatchPolicy>
							<strictOrderDispatchPolicy />
						</dispatchPolicy>
						<subscriptionRecoveryPolicy>
							<lastImageSubscriptionRecoveryPolicy />
						</subscriptionRecoveryPolicy>
					</policyEntry>
				</policyEntries>
			</policyMap>
		</destinationPolicy>
		<persistenceAdapter>


 
			<journaledJDBC journalLogFiles="5" dataDirectory="../data"
dataSource="#derby-ds"/> 

		</persistenceAdapter>
		<transportConnectors>
			<transportConnector uri="tcp://localhost:61617"/>
		</transportConnectors>
		<networkConnectors>
			<networkConnector name="default-nc" uri="multicast://default"/>
		</networkConnectors>
	</broker>
 
	<bean id="derby-ds" class="org.apache.derby.jdbc.EmbeddedDataSource">
		<property name="databaseName" value="derbydb"/>
		<property name="createDatabase" value="create"/>
	</bean>
</beans>


On the slave I have:

<beans>
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>

<broker brokerName="localhost2" useJmx="true"
masterConnectorURI="tcp://localhost:61617"
shutdownOnMasterFailure="false" xmlns="http://activemq.org/config/1.0">
	<destinationPolicy>
		<policyMap>
			<policyEntries>
				<policyEntry topic="FOO.>">
					<dispatchPolicy>
						<strictOrderDispatchPolicy />
					</dispatchPolicy>
					<subscriptionRecoveryPolicy>
					<lastImageSubscriptionRecoveryPolicy />
					</subscriptionRecoveryPolicy>
				</policyEntry>
			</policyEntries>
		</policyMap>
	</destinationPolicy>
<persistenceAdapter> 
	<journaledJDBC journalLogFiles="5" dataDirectory="../data"
dataSource="#derby-ds"/>
</persistenceAdapter>
<transportConnectors>
	<transportConnector uri="tcp://localhost:61627"/>
</transportConnectors>
<networkConnectors>
	<networkConnector name="default-nc" uri="multicast://default"/>
</networkConnectors>
</broker>

<bean id="derby-ds" class="org.apache.derby.jdbc.EmbeddedDataSource">
	<property name="databaseName" value="derbydb"/>
	<property name="createDatabase" value="create"/>
</bean>
 
</beans>



On the spring context file:

<!-- Create pooled JMS ConnectionFactory of ActiveMQ -->
	<bean id="jmsFactory"
class="org.apache.activemq.pool.PooledConnectionFactory">
	  	<property name="connectionFactory">
	       <bean class="org.apache.activemq.ActiveMQConnectionFactory">
	    	  	<property name="brokerURL"
value="failover:(${Report.Broker.URL},${Report.Broker.URL2})?jms.redeliveryPolicy.allPrefetchValues=${allPrefetchValues}&amp;jms.redeliveryPolicy.initialRedeliveryDelay=${initialRedeliveryDelay}&amp;jms.redeliveryPolicy.maximumRedeliveries=${maximumRedeliveries}&amp;jms.redeliveryPolicy.useCollisionAvoidance=${useCollisionAvoidance}"
/>
	       </bean>
	     </property>
	</bean>


Where

Report.Broker.URL=tcp://192.168.0.100:61617
Report.Broker.URL2=tcp:// 192.168.0.101:61627
allPrefetchValues=1
initialRedeliveryDelay=30000
maximumRedeliveries=3
useCollisionAvoidance=true

Regards,
Cristian




rvenkat23 wrote:
> 
> Hi
> 
> I am also facing the same problem. When the master is killed and slave
> becomes the master the messages already placed in the queue are stuck. But
> its able to process the new message produced after slave becomes the
> master. 
> 
> We are using ActiveMQ 4.1.1. what am i doing wrong? Can any one post
> working master / slave example with configuration please.
> 
> Here is our config (shared file system):
> 
> 
>  <broker brokerName="broker61650" useJmx="true" persistent="true"
> xmlns="http://activemq.org/config/1.0">
> 
>  <persistenceAdapter>
>         <journaledJDBC journalLogFiles="5"
> dataDirectory="/SAN/jms/test/"/>
>  </persistenceAdapter>
> 
>     <transportConnectors>
>        <transportConnector name="openwire" uri="tcp://localhost:61650"/>
>     </transportConnectors>
> </broker>
> 
> Thanks,
> Venkatesh.
> 
> 
> Cristian3001 wrote:
>> 
>> I've solved the problem by adding the following to the failover
>> definition in my spring configuration files of the listener:
>> 
>> <property name="brokerURL"
>> value="failover:(${host1},${host2})?jms.redeliveryPolicy.allPrefetchValues=${allPrefetchValues}&amp;jms.redeliveryPolicy.initialRedeliveryDelay=${initialRedeliveryDelay}&amp;jms.redeliveryPolicy.maximumRedeliveries=${maximumRedeliveries}&amp;jms.redeliveryPolicy.useCollisionAvoidance=${useCollisionAvoidance}"
>> />
>> 
>> before it was just: 
>> 
>> <property name="brokerURL" value="failover:(${host1},${host2})" />
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Problems-with-ActiveMQ4.1.1---Master-Slave-brokers-tp10836705p17758198.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message