views:

315

answers:

1

Hi!

I have an pair of JBoss 5.1 servers clustered together to act as an fault-tolerant JMS server.

I configured them to use MySQL datastore (with clustering setting enabled in mysql-persistence-service.xml), I created an topic mbean in destinations-service.xml by defining:

   <mbean code="org.jboss.jms.server.destination.TopicService" name="jboss.messaging.destination:service=Topic,name=ECM-PRM-Topic" xmbean-dd="xmdesc/Topic-xmbean.xml">
    <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
    <depends>jboss.messaging:service=PostOffice</depends>
    <attribute name="Clustered">true</attribute>
    <attribute name="SecurityConfig">
            <security>
                    <role name="ecm-role" write="true" />
                    <role name="prm-role" read="true" create="true" />
            </security>
    </attribute>

My client (J2SE!) is connecting to this JMS servers using:

      // Step 1. Create an initial context to perform the JNDI lookup.
  initialContext = new InitialContext(p);
  // Step 3. Perform a lookup on the Connection Factory
  ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ClusteredConnectionFactory");
  // Step 2. Perfom a lookup on the queue
  Destination target = (Destination)initialContext.lookup("/topic/ECM-PRM-Topic");

When the following sequence of events occurs:

  1. Node1 is up, Node2 is down.
  2. Client connects to the JMS and creates an durable subscriber on the topic "ECM-PRM-Topic".
  3. Client disconnects leaving the durable subscription.
  4. Some other client publishes messages on the topic "ECM-PRM-Topic".
  5. Node1 goes down.
  6. Node2 goes up.
  7. Some other client publishes messages on the topic "ECM-PRM-Topic" again.
  8. Client connects again to the durable subscription.
  9. Client disconnects
  10. Node 1 goes up.
  11. Client connects again to the durable subscription.

The messages published in step 4 are stored in the database, and are waiting (I can see them in MySQL) for the client to reconnect. (that's OK)

The node started in step 6 does not know of any durable subscriptions on that topic. (Why??)

The messages published in step 7 disappear immediately. (since there is no known durable nor any clients connected)

When client connects in step 8 it creates a new durable and no messages are delivered to it (however there are still messages in MySQL).

In step 10 the client receives all messages from the durable excluding the messages from step 7 witch are lost completly.

I'd like to have 100% assurance that no messages can be lost. All messages should be stored on the durable and in MySQL database until there are consumed by the client.

Any suggestions what is wrong?

Is there any way to configure an durable subscription in JBoss in XML files (before any client creates an DurableSubscriber)?

The full client code I use is HERE

+1  A: 

We found out that it is not possible for JBoss to handle such situations correctly.

The fact of "durable subscription" creation is broadcast to all nodes. If one of the nodes is down it will not be aware of the durable subscription created on the other one. That results in data loss in situation described above.

http://community.jboss.org/message/517448#517448

Chris
Thanks for the info, this is useful to know about.
Jon