[jboss-user] [JBoss Messaging] - Re: All messages are not persisted in Database.

sajankn do-not-reply at jboss.com
Thu Jul 17 13:40:23 EDT 2008


The messages are persisted in the database (Oracle). In the oracle-persistence-service.xml I've turned the UsingBatchUpdates to false.

<attribute name="UsingBatchUpdates">false</attribute>

There are no warnings or errors on the server.

All the 5 publishers are different instance of the same class and they run simultaneously and publish 1000 messages each.

Except for 1 publisher, all other messages (4000) are persisted to database and is consumed by the subscriber.

This happens only during the first run of a fresh setup (AS, JBM, DB, Subscriber, Publisher all are running for the first time). In all the subsequent runs no messages are lost.

Publisher Code:

  | String destinationName = "/topic/testTopic";
  | InitialContext ic = new InitialContext();
  | TopicConnectionFactory cf = (TopicConnectionFactory)ic.lookup("/ClusteredConnectionFactory");
  | Topic topic = (Topic)ic.lookup(destinationName);
  | TopicConnection connection = cf.createTopicConnection();
  | TopicSession session = connection.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
  | TopicPublisher publisher = session.createPublisher(topic);
  | connection.start();
  | String msgStr = "Hello World";
  | TextMessage tm = session.createTextMessage(msgStr);
  | publisher.setTimeToLive(604800000);
  | publisher.publish(tm);
  | 

Subscriber Code:

  | String destinationName = "/topic/testTopic";
  | InitialContext ic = new InitialContext();
  | TopicConnectionFactory cf = (TopicConnectionFactory)ic.lookup("/ClusteredConnectionFactory");
  | Topic topic = (Topic)ic.lookup(destinationName);
  | TopicConnection connection = cf.createTopicConnection("admin", "admin");
  | connection.setClientID("MyClientID");
  | TopicSession session = connection.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
  | session.createDurableSubscriber(topic, "Alpha");
  | TopicSubscriber subscriber = session.createDurableSubscriber(topic, "Alpha");
  | connection.start();
  | 

In my actual code I've done all the exception handling.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4165140#4165140

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4165140



More information about the jboss-user mailing list