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:
- Node1 is up, Node2 is down.
- Client connects to the JMS and creates an durable subscriber on the topic "ECM-PRM-Topic".
- Client disconnects leaving the durable subscription.
- Some other client publishes messages on the topic "ECM-PRM-Topic".
- Node1 goes down.
- Node2 goes up.
- Some other client publishes messages on the topic "ECM-PRM-Topic" again.
- Client connects again to the durable subscription.
- Client disconnects
- Node 1 goes up.
- 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