activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From patzerbud <patzer...@hotmail.com>
Subject virtual topics plus failover
Date Thu, 15 Apr 2010 20:25:10 GMT

All:

I think I have a relatively simple - and typical - environment but am having
trouble getting failover to work the way I expect it to. Here is my
environment:

ActiveMQ 5.3.1 running on linux (CentOS 5.2) - two nodes; primary & failover
Shared Database (jdbcPersistenceAdapter) 
Multiple JBoss app servers (>2) - these are clustered - for each of three
separate applications
Oracle RAC 10g

I have a virtual topic, let's call it:

VirtualTopic.Orders

and three corresponding consumer queues:

Consumer.App1.VirtualTopic.Orders
Consumer.App2.VirtualTopic.Orders
Consumer.App3.VirtualTopic.Orders

So, JBoss cluster 1 (running app 1) consumes from the first queue,
JBoss cluster 2 (running app 2) consumes from the second, etc.

All three apps publish to the virtual topic and all three apps are expected
to consume all messages - reliably.

All works well when all app servers are running (i.e. consuming msgs). I can
shutdown the primary ActiveMQ instance and everything fails over to the
second. I restart the primary and shutdown the secondary and, again,
everything works as billed with no lost messages. So far, so good.

However, if I shutdown all app servers for one of the applications (let's
say App3) and run the same test as above; as soon as ActiveMQ fails over,
then all messages held for App3 are lost. They now build up from 0 and when
I shutdown the failover MQ node, everything goes back to the primary but,
again, it starts over from 0 for the "missing" application.

What I expect to happen is that when the failover (secondary) MQ node takes
over it recognizes there are already n msgs queued up for the "missing"
application and to just keep adding to those.

It's like I want a durable queue subscriber - so I can take advantage of
Virtual Topics (multiple consumers but only 1 msg) but also with durability.

Here is the activemq.xml file on both nodes:

<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:amq="http://activemq.apache.org/schema/core"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd">

    <!-- Allows us to use system properties as variables in this
configuration file -->
    <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <value>file:${activemq.base}/conf/credentials.properties</value>
        </property>
    </bean>

    <!--
        The <broker> element is used to configure the ActiveMQ broker.
    -->
    <broker xmlns="http://activemq.apache.org/schema/core"
			brokerName="myBroker"
			persistent="true"
			dataDirectory="${activemq.base}/data"
			destroyApplicationContextOnShutdown="true"
			destroyApplicationContextOnStop="true"
			supportFailOver="true"
			systemExitOnShutdown="true"
			useLocalHostBrokerName="false"
			useShutdownHook="false">

        <!--
			For better performances use VM cursor and small memory limit.
			For more information, see:

            http://activemq.apache.org/message-cursors.html

            Also, if your producer is "hanging", it's probably due to
producer flow control.
            For more information, see:
            http://activemq.apache.org/producer-flow-control.html
        -->

        <destinationPolicy>
            <policyMap>
              <policyEntries>
                <policyEntry topic=">" producerFlowControl="true"
memoryLimit="5mb" useCache="false">
                  <pendingSubscriberPolicy>
                    <vmCursor />
                  </pendingSubscriberPolicy>
                </policyEntry>
                <policyEntry queue=">" producerFlowControl="true"
memoryLimit="5mb" useCache="false">
                  <!-- Use VM cursor for better latency
                       For more information, see:

                       http://activemq.apache.org/message-cursors.html

                  <pendingQueuePolicy>
                    <vmQueueCursor/>
                  </pendingQueuePolicy>
                  -->
                </policyEntry>
              </policyEntries>
            </policyMap>
        </destinationPolicy>

		<destinations>
			<topic name="activemq/topic/orders"     
physicalName="VirtualTopic.Orders" />
			<queue name="activemq/queue/app1/orders"
physicalName="Consumer.App1.VirtualTopic.Orders" />
			<queue name="activemq/queue/app2/orders"
physicalName="Consumer.App2.VirtualTopic.Orders" />
			<queue name="activemq/queue/app3/orders"
physicalName="Consumer.App3.VirtualTopic.Orders" />
		</destinations>

        <!--
            The managementContext is used to configure how ActiveMQ is
exposed in
            JMX. By default, ActiveMQ uses the MBean server that is started
by
            the JVM. For more information, see:

            http://activemq.apache.org/jmx.html
        -->
        <managementContext>
            <managementContext createConnector="false"/>
        </managementContext>

        <persistenceAdapter>
			<jdbcPersistenceAdapter dataSource="#oracle-ds"/>
        </persistenceAdapter>

        <transportConnectors>
            <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
        </transportConnectors>

    </broker>

    <!--
        Enable web consoles, REST and Ajax APIs and demos
        Take a look at activemq-jetty.xml for more details
    -->
    <import resource="jetty.xml"/>

	<bean id="oracle-ds" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
	  <property name="driverClassName"
value="oracle.jdbc.driver.OracleDriver"/>
	  <property name="url" value="jdbc:oracle:thin:@oradb01:1521:ords1"/>
	  <property name="username" value="username"/>
	  <property name="password" value="password"/>
	  <property name="maxActive" value="200"/>
	  <property name="poolPreparedStatements" value="true"/>
	</bean>

</beans>

Any help would be greatly appreciated!

TIA,

Mike L. (aka patzerbud)

-- 
View this message in context: http://old.nabble.com/virtual-topics-plus-failover-tp28260238p28260238.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message