Here's the configurations I'm testing with GlassFish 3.1.2.2 (using HA-JDBC
for peer and enhanced configurations): Embedded Conventional Broker Cluster
With Master Broker: configure-jms-cluster --clustertype=conventional
--configstoretype=masterbroker mascluster Embedded Conventional Broker
Cluster of Peer Brokers: configure-jms-cluster --configstoretype shareddb
--messagestoretype file --clustertype conventional --dbvendor derby --dburl
jdbc:ha-jdbc:glassfish --property
cluster.sharecc.persist.jdbc.derby.driver=net.sf.hajdbc.sql.Driver mascluster
Local Enhanced Broker Cluster: set mascluster.jms-service.type=LOCAL
configure-jms-cluster --clustertype enhanced --dbvendor derby --dburl
jdbc:ha-jdbc:glassfish --property
imq.persist.jdbc.derby.driver=net.sf.hajdbc.sql.Driver mascluster I have a
simple echo bean that puts the produced text message on a topic which the
client consumes and verifies. The portion that hangs is a QueueBrowser using
hasMoreItem = browser.getEnumeration().hasMoreElements(); This is only used
in unit tests to wait for the queue to empty before reading all the messages
on the topic. If I remove this code and use a delay I'm able to read the
topic. Basically I'm trying to test fail over with a large number of messages
(10000) and make sure they come full circle in the topic. I realize only
enhanced cluster allows for guaranteed message delivery, but I want the
client to be able to continue to send messages when a broker fails. One thing
that helped is to catch exceptions in the client and get a new connection on
failure: public final void getNewSender() throws JMSException,
NamingException { // Connection queueConnection =
queueConnectionFactory.createQueueConnection(); // Lookup queue queue =
jndiLookup(initialContext, "jms/TestQueue"); // Session queueSession =
queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); //
Sender sender = queueSession.createSender(queue); } for (int i = 0; i <
MESSAGES_TO_SEND; i++) { try {
sender.send(queueSession.createTextMessage(TEST_MSG)); try {
Thread.sleep(MESSAGES_DELAY); } catch (InterruptedException e) { throw new
RuntimeException(e); } } catch (JMSException e) { log.warn(e.getMessage());
getNewSender(); } } I haven't been able to find a good code example that
handles a failed broker connection in the various GlassFish broker
configurations.
--
[Message sent by forum member 'sgjava']
View Post: http://forums.java.net/node/893426