I've raised an issue to investigate this issue
http://issues.apache.org/activemq/browse/AMQ-755
I've not had a chance to look in detail at the test code but a few
initial observations...
* the mere presence of a queue on one broker does not imply it is
replicated to every other broker in network; things tend to move on a
demand basis; so a message typicaly has to move from one to the other.
* similarly the admin view of brokers do not update automatically on
restart; destinations are lazily loaded or created as they are used
(producers/consumers are created on the broker).
On 6/16/06, red3 <[EMAIL PROTECTED]> wrote:
We have been experiencing some fairly serious problems with timeouts using
Spring, Lingo and a network of ActiveMQ brokers.
As I understand it, lingo creates temporary queues to transport the remote
procedure calls across JMS.
Note that it can use regular queues as well. If no response queue is
used on the client side then a temporary queue is used.
We are suspicious that the messaging roundtrip gets interrupted or lost when
using broker networks.
We integrated ActiveMQ 4.0 into our project this week and ran the JMX
jconsole to look at our broker network.
We see temporary queues come and go, and what we are expecting is complete
replication of the queues on each broker. Is this expectation correct?
This is not what we are seeing.
We believe that two things are happening:
1) Temporary queues are not being cleaned up properly on all brokers.
2) Temporary queues are not being created on a new broker when it is taken
down and then restarted.
Your feedback on these apparent issues would be appreciated.
To substantiate our theory we created a couple of JUnit tests. (Our test
cases do not include Lingo - just ActiveMQ client to broker.)
TEST 1
We create a network of brokers, create a message queue, send a message and
then take a broker down. We are expecting that the temporary message queue
created will be removed from both brokers. It is not.
The test fails on the last assert with:
junit.framework.AssertionFailedError: No queues on broker 3 expected:<1> but
was:<0>
Source code follows:
public void testTempQueueCleanup() throws Exception {
ActiveMQConnectionFactory cf;
Connection conn = null;
Session sess = null;
try {
cf = new ActiveMQConnectionFactory(
"failover:(tcp://localhost:61626%3FsoTimeout=5000,tcp://localhost:61627%3FsoTimeout=5000)?maximumRetries=0&establishConnectionTimeout=21000&keepAliveTimeout=300000");
conn = cf.createConnection();
sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
TemporaryQueue q = sess.createTemporaryQueue();
BrokerService broker2 = createBroker("broken2",
"tcp://localhost:61627", "static:(tcp://localhost:61626)");
Thread.sleep(5000);
assertEquals("No queues on broker 1", 1,
broker1.getAdminView().getTemporaryQueues().length);
assertEquals("No queues on broker 2", 1,
broker2.getAdminView().getTemporaryQueues().length);
q.delete();
assertEquals("Temp queue left behind on broker 1", 0,
broker1.getAdminView().getTemporaryQueues().length);
assertEquals("Temp queue left behind on broker 2", 0,
broker2.getAdminView().getTemporaryQueues().length);
broker2.stop();
} finally {
if (sess!=null)
sess.close();
if (conn!=null)
conn.close();
}
}
TEST 2
When stopping a broker and then restarting it, we expect to see all queues
replicated on the new broker.
This test fails with:
junit.framework.AssertionFailedError: No queues on broker 3 expected:<1> but
was:<0>
Source code:
public void testTempQueueRecovery() throws Exception {
ActiveMQConnectionFactory cf;
Connection conn = null;
Session sess = null;
try {
cf = new ActiveMQConnectionFactory(
"failover:(tcp://localhost:61626%3FsoTimeout=5000,tcp://localhost:61627%3FsoTimeout=5000)?maximumRetries=0&establishConnectionTimeout=21000&keepAliveTimeout=300000");
conn = cf.createConnection();
sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
TemporaryQueue q = sess.createTemporaryQueue();
BrokerService broker2 = createBroker("broken2",
"tcp://localhost:61627",
"static:(tcp://localhost:61626,tcp://localhost:61628)");
Thread.sleep(5000);
assertEquals("No queues on broker 1", 1,
broker1.getAdminView().getTemporaryQueues().length);
assertEquals("No queues on broker 2", 1,
broker2.getAdminView().getTemporaryQueues().length);
BrokerService broker3 = createBroker("broken3",
"tcp://localhost:61628",
"static:(tcp://localhost:61626,tcp://localhost:61627)");
assertEquals("No queues on broker 3", 1,
broker3.getAdminView().getTemporaryQueues().length);
Thread.sleep(5000);
q.delete();
Thread.sleep(5000);
assertEquals("Temp queue left behind on broker 1", 0,
broker1.getAdminView().getTemporaryQueues().length);
assertEquals("Temp queue left behind on broker 2", 0,
broker2.getAdminView().getTemporaryQueues().length);
assertEquals("Temp queue left behind on broker 3", 0,
broker3.getAdminView().getTemporaryQueues().length);
broker3.stop();
broker2.stop();
} finally {
if (sess!=null)
sess.close();
if (conn!=null)
conn.close();
}
}
--
View this message in context:
http://www.nabble.com/Temporary-Queue-behaviour-with-Networks-of-Brokers-t1796463.html#a4895448
Sent from the ActiveMQ - User forum at Nabble.com.
--
James
-------
http://radio.weblogs.com/0112098/