0 Replies Latest reply on Apr 14, 2006 8:57 AM by Vishy Kadambari

    Need Help with Rollback issue and message re-try

    Vishy Kadambari Newbie

      Hi All,

      I am not able to figure out why my messages are not
      being sent back to
      the queue on a session rollback. I am not using MDB's.
      Following is
      how I am setting up my connection to a Topic

      //ConnectionFactory (using
      TopicConnectionFactory)
      TopicConnection connection =
      connectionFactory.createTopicConnection(username,password);

      connection.setClientID(clientId);

      TopicSession session =
      connection.createTopicSession(true,0);

      TopicSubscriber subscriber =
      session.createDurableSubscriber(topic,subscriptionName);

      In a while loop, I have the call to receive messages:

      Message msg = subscriber.receive(1000);

      after receiving a message, I process it, and call
      session.commit(). But, if I run into
      problems while processing the message, I am calling
      session.rollback(). But, I don't
      see the messages being persisted back into the db
      table (JMS_MESSAGES) after the
      call to session.rollback(). I was hoping that they
      would be, so that when the consumer
      is re-started, these messages can be re-delivered.
      What could be going wrong? I thought
      that if I create a topic session with 'transacted' set
      to true, I will be able to restore messages
      in case of processing errors...

      Also, in the above situation, how can I configure the
      number of 're-try' attempts? In an MDB,
      one can do that in the deployment descriptor...but, in
      a situation like the one above, how do I
      tell the messaging server to 're-try' 3 or 4 times,
      before sending the message to DLQ....

      Please help!