activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Sparg <timothy.sp...@corefreight.com>
Subject Consumers are being duplicated
Date Fri, 05 Feb 2010 10:50:24 GMT

Hi all,

We are using ActiveMQ 5.2.0 over the WAN. We have a remote application that
has 2 consumers listening for messages. These 2 consumers use message
selectors in order to receive different types of messages and process these
messages accordingly. At first we were using Broker-To-Broker communication
but we found that the consumers stopped receiving messages until we
restarted the remote broker. We are now running a single broker
configuration using the failover transport connection. This seems to work
well but after a day or so the consumers on the remote application start to
duplicate.
We are closing all the consumers in a shut down hook as well.

The broker is using the default configuration with a change in the transport
connector’ port and the broker name.
How can I ensure that duplicate consumers are not created?


<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   
  http://activemq.apache.org/camel/schema/spring
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">

    <!-- Allows us to use system properties as variables in this
configuration file -->
    <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>

    <broker xmlns="http://activemq.apache.org/schema/core"
brokerName="repserv1" dataDirectory="${activemq.base}/data">

        <!-- Destination specific policies using destination names or
wildcards -->
        <destinationPolicy>
            <policyMap>
                <policyEntries>
                    <policyEntry queue=">" memoryLimit="100mb"/>
                    <policyEntry topic=">" memoryLimit="100mb">
                        <dispatchPolicy>
                            <strictOrderDispatchPolicy/>
                        </dispatchPolicy>
                        <subscriptionRecoveryPolicy>
                            <lastImageSubscriptionRecoveryPolicy/>
                        </subscriptionRecoveryPolicy>
                    </policyEntry>
                </policyEntries>
            </policyMap>
        </destinationPolicy>

        <!-- Use the following to configure how ActiveMQ is exposed in JMX
-->
        <managementContext>
            <managementContext createConnector="true"/>
        </managementContext>
        
        <!-- The store and forward broker networks ActiveMQ will listen to
-->
        <networkConnectors>
        </networkConnectors>
        
        <persistenceAdapter>
            <amqPersistenceAdapter syncOnWrite="false"
directory="${activemq.base}/data" maxFileLength="20 mb"/>
        </persistenceAdapter>


        <!--  The maximum about of space the broker will use before slowing
down producers -->
        <systemUsage>
            <systemUsage>
                <memoryUsage>
                    <memoryUsage limit="512 mb"/>
                </memoryUsage>
                <storeUsage>
                    <storeUsage limit="1 gb" name="foo"/>
                </storeUsage>
                <tempUsage>
                    <tempUsage limit="100 mb"/>
                </tempUsage>
            </systemUsage>
        </systemUsage>


        <!-- The transport connectors ActiveMQ will listen to -->
        <transportConnectors>
            <transportConnector name="openwire" uri="tcp://localhost:3545"
discoveryUri="multicast://default"/>
        </transportConnectors>

    </broker>

    <!--
    ** Lets deploy some Enterprise Integration Patterns inside the ActiveMQ
Message Broker
    ** For more details see
    **
    ** http://activemq.apache.org/enterprise-integration-patterns.html
    -->
    <camelContext id="camel"
xmlns="http://activemq.apache.org/camel/schema/spring">

        <!-- You can use a <package> element for each root package to search
for Java routes -->
        <package>org.foo.bar</package>

        <!-- You can use Spring XML syntax to define the routes here using
the <route> element -->
        <route>
            <from uri="activemq:example.A"/>
            <to uri="activemq:example.B"/>
        </route>
    </camelContext>


    <!-- An embedded servlet engine for serving up the Admin console -->
    <jetty xmlns="http://mortbay.com/schemas/jetty/1.0">
        <connectors>
            <nioConnector port="8161"/>
        </connectors>

        <handlers>
            <webAppContext contextPath="/admin"
resourceBase="${activemq.base}/webapps/admin" logUrlOnStart="true"/>
            <webAppContext contextPath="/demo"
resourceBase="${activemq.base}/webapps/demo" logUrlOnStart="true"/>
            <webAppContext contextPath="/fileserver"
resourceBase="${activemq.base}/webapps/fileserver" logUrlOnStart="true"/>
        </handlers>
    </jetty>

 
</beans>


-- 
View this message in context: http://old.nabble.com/Consumers-are-being-duplicated-tp27466152p27466152.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message