Hi everyone, I'm a relative n00b to jboss, but fairly experienced in Java/Servlets in general. I'm trying to put together a basic publish/subscribe system where the publishes come from a servlet and are sent to durable subscriber clients running on various (3 or 4) other machines. I'm running on RedHat (varying versions) under java 1.4.1.
The problem is this; Lets say I have 3 client nodes (named 1,2,3), a server, and a sender. In normal operation, things work fine, sender sends, all 3 clients receive. Now, I take down node number 1 (ctrl-c). I send out 10 messages. Clients 2 and 3 receive all 10 messages, but I get this error in jboss standard out:
16:25:39,325 WARN [DeliveryRunnable] Failed to deliver the message to the client, clearing up connection resources
org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection for locator - InvokerLocator [socket://192.168.1.103:3439/?dataType=jms&marshaller=org.jboss.jms.server.remoting.JMSWireFormat&serializationType=jboss&socket.check_connection=false&timeout=0&unmarshaller=org.jboss.jms.server.remoting.JMSWireFormat]
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
...this is as expected, it couldn't get to that node because I killed the client. Now I restart node number 1. It only receives last 9 messages (not the 10 I would expect). I am using the standard jboss-4.0.3SP1, along with the default jboss database. Could this problem be related to the datastore? If it did, I would assume my dead client wouldn't receive any messages at all when it came back up.
My client and sender code looks like this:
topicfactory = (TopicConnectionFactory)context.lookup(factoryName);
topiccon = (TopicConnection)topicfactory.createTopicConnection(username, password);
topicsess = topiccon.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
topic = (Topic)context.lookup("topic/testTopic");
topicpub = topicsess.createPublisher(topic);
TextMessage message = topicsess.createTextMessage();
topicpub.publish(message, DeliveryMode.PERSISTENT, Message.DEFAULT_PRIORITY, 1800000);
Properties properties = new Properties();
// create the JNDI initial context.
// topic = (Topic) context.lookup(CoreProperties.getInstance().getProperty("clusterID"));
context = new InitialContext(properties);
factory = (TopicConnectionFactory) context.lookup(factoryName);
topic = (Topic) context.lookup("topic/testTopic");
// create the connection
connection = factory.createTopicConnection(username, passwd);
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
subscriber = session.createDurableSubscriber(
ANY leads or help would be greatly appreciated. Thanks!
Whoops- forgot to mention the version of messaging- using jboss-messaging-1.0.1.CR2
Just to clarify:
You have 3 consumers in different VMs consuming using durable subscriptions, a producer in another VM and a server in another VM, they are all on different physical nodes.
You start them up and then kill one of the consumers.
You then send 10 messages.
The 2 remaining consumers receive 10 messages ok.
You start another consumer, it only receives 9 messages.
Is this correct?
I was wondering if you are still seeing this problem?
We are going to cut a release fairly soon, so if there is an issue here we want to get a fix in ASAP
Thanks for your patience.
Ok I have replicated this - a fix should be on it's way soon...
Ok I fixed this.
The problem here was not that the message was getting lost (it wasn't) - if you restart the server the "lost" message re-appears. That would be spec compliant - but annoying.
So I've changed it so that if a client dies then it's outstanding deliveries get cancelled and redelivered to any new consumers. This gives a better user experience.
This fix will be in the next release, which should be out early next week.
Thanks for attempting and succesfully reproducing. I have been away from the net for awhile with heath issues. I was able to figure out what was happening. I was attempting to re-subscribe with the same clientID (not subscription ID), and it was taking awhile for the jboss server to time out the clientID. Reconnecting with a different client ID did the trick. Looks like you may have found a problem anyway. Thanks for the effort!