6 Replies Latest reply on Jul 10, 2006 2:01 PM by dreadpirateflint

    Problem re-delivering to Durable Subscriber

    dreadpirateflint

      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]
      at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:283)
      at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:116)
      at org.jboss.remoting.Client.invoke(Client.java:610)
      at org.jboss.remoting.Client.invoke(Client.java:602)
      at org.jboss.remoting.Client.invoke(Client.java:587)
      at org.jboss.jms.server.endpoint.DeliveryRunnable.run(DeliveryRunnable.java:85)
      at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
      at java.lang.Thread.run(Thread.java:536)
      Caused by: java.net.ConnectException: Connection refused
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
      at java.net.Socket.connect(Socket.java:426)
      at java.net.Socket.connect(Socket.java:376)
      at java.net.Socket.(Socket.java:291)
      at java.net.Socket.(Socket.java:119)
      at org.jboss.remoting.transport.socket.SocketClientInvoker.createSocket(SocketClientInvoker.java:217)
      at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.getConnection(MicroSocketClientInvoker.java:631)
      at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:279)


      ...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:

      Sender:
      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);
      topiccon.start();
      TextMessage message = topicsess.createTextMessage();
      message.setText(text);
      topicpub.publish(message, DeliveryMode.PERSISTENT, Message.DEFAULT_PRIORITY, 1800000);


      Client:

      Properties properties = new Properties();

      properties.put(Context.SECURITY_PRINCIPAL, username);
      properties.put(Context.SECURITY_CREDENTIALS, passwd);
      // 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);
      connection.setClientID(subscriptionName);
      session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
      subscriber = session.createDurableSubscriber(
      topic, subscriptionName);
      subscriber.setMessageListener(new CustodianListener());
      connection.start();


      ANY leads or help would be greatly appreciated. Thanks!

      /DPF