Consumer doesn't failover outside JBossAS 5.1 container
steeven_lee Apr 19, 2010 4:17 AMHi all,
I'm testing JBoss 5.1 messaging with "all" configuration.
the MDB can auto recovery after one node shutdown, but the JMS message consumer outside that use JMS API desn't receive and message when one node shutdown.
Here is my test code:
while (true) {
try {
TopicConnection topicConn = tcf.createTopicConnection();
TopicSession topicSession = topicConn.createTopicSession(false,
TopicSession.AUTO_ACKNOWLEDGE);
MessageConsumer consumer = topicSession.createConsumer(topic);
topicConn.start();
while (true) {
TextMessage msg = (TextMessage) consumer.receive();
if (msg != null) {
System.out.println("receive0 conn: " + topicConn);
System.out.println("receive0 msg: " + msg.getText());
}
}
} catch (Exception e) {
System.out.println("listen error: " + e);
}
}
Another thread send message every 5 second. The console works right when 2 server nodes both working. After 1 node shut down, the thread hang and never response even if the node restarted.
It's interesting that the "consumer.receive(timeout)" don't work too, but this method will throw javax.jms.IllegalStateException, that gives a change to reestablish the connection and listen again.
tcf:
JBossConnectionFactory->ClusteredConnectionFactoryDelegate[SIDs={2,4}]
topicConn:
JMSRemotingConnection[bisocket://10.80.1.113:4457/?JBM_clientMaxPoolSize=200&clientLeasePeriod=10000&clientSocketClass=org.jboss.jms.client.remoting.ClientSocketWrapper&connectionWait=10&dataType=jms&marshaller=org.jboss.jms.wireformat.JMSWireFormat&numberOfCallRetries=1&pingFrequency=214748364&pingWindowFactor=10&socket.check_connection=false&stopLeaseOnFailure=true&timeout=0&unmarshaller=org.jboss.jms.wireformat.JMSWireFormat&validatorPingPeriod=10000&validatorPingTimeout=5000]
I read the JBoss Cluster document, the Failover should be recovered under table, am I leading the wrong way?
BTW, in wiki there is a demo that send JMS, every time a Connection is created, is it a MUST? I tested it 7 sec to send 100 msg, 1.5 sec if the connection is cached.