activemq-users mailing list archives

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


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

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:


and three corresponding consumer queues:


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

    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.

    <!-- Allows us to use system properties as variables in this
configuration file -->
        <property name="locations">

        The <broker> element is used to configure the ActiveMQ broker.
    <broker xmlns=""

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


            Also, if your producer is "hanging", it's probably due to
producer flow control.
            For more information, see:

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



			<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" />

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

            <managementContext createConnector="false"/>

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

            <transportConnector name="openwire" uri="tcp://"/>


        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"
	  <property name="driverClassName"
	  <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"/>


Any help would be greatly appreciated!


Mike L. (aka patzerbud)

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message