tags:

views:

30

answers:

1

I have the following problem: I have several sites with a local ActiveMQ broker that forwards to a remote broker (in a datacenter). This connection is often unstable, and goes down several times a month for a few minutes or hours at a time.

Messages therefore need to wait on the local broker if the remote broker is not accessible at the moment.

I have the following ActiveMQ configuration:

    <networkConnectors>

            <networkConnector uri="static://(tcp://my-remote-broker:61616)" 
                name="myremotebroker" dynamicOnly="false"
                conduitSubscriptions="true"
                decreaseNetworkConsumerPriority="false">

                    <!-- Exclude all destinations by default -->

                    <excludedDestinations>
                            <queue physicalName=">" />
                            <topic physicalName=">" />
                    </excludedDestinations>

                    <!-- Only forward these to our connection -->

                    <staticallyIncludedDestinations>
                            <topic physicalName="MySpecialTopic"/>
                    </staticallyIncludedDestinations>
            </networkConnector>
    </networkConnectors>

This forwards messages from the local broker (on topic MySpecialTopic), to the remote broker. This works when the connection is stable.

However, I tried temporarily disabling the internet connection, so that the local broker lost connection with the remote broker. At that point I sent a new message, which was enqueued on the local broker, but never arrived on the remote broker, even after the local broker re-connected!

Is there something in the ActiveMQ configuration that I am missing?

Thanks!

A: 

Hi,

You are using a TOPIC, which is hit or miss. This means that sending a message while the connection is down WILL be lost, which is standard behaviour for a topic ( only subscribers that are subscribed at the time of the send of the message will receive the message). (http://activemq.apache.org/how-does-a-queue-compare-to-a-topic.html)

You should use a Queue if you want the remote Consumer to receive the message OR should setup your subscribers as durable subscribers to assure they will receive messages at all times.. (http://activemq.apache.org/how-do-durable-queues-and-topics-work.html)

Noctris
All my consumers are durable subscribers. It's been a while since this problem occurred, and since I've moved to RabbitMQ. The main problem I had was that occasionally ActiveMQ would disconnect/reconnect many times, and its KahaDB data directory would get corrupted. In these cases, I couldn't even restart ActiveMQ without deleting the data/ directory.
T.K.
Hmm.. i am familiar with the KahaDB problems , not with the durable consumers not getting the messages over a failover network.. however, there have been some strange other things in that area ( Several Advisory Queue's have the same issue and a bug that i have reported has been accepted for the next release) anyways.. glad you got it solved. BTW: how does rabbitMQ perform over the net ? We chose ActiveMQ at some point but i'm considering a move to RabbitMQ since stability remains an issue with ActiveMQ :s
Noctris