3 Replies Latest reply on Mar 22, 2007 6:43 PM by vitor_b

    Message Cache configuration problem

    vitor_b

      Hello

      I'm confused.

      That what i need to achieve is to store all JMS messages in persistent storage, for example in DB. PersistenceManager will help me, but first i have to force MessageCache not to store any single message. All messages have to be stored in DB.

      I tried to set attributes HighMemoryMark and MaxMemoryMark to 0, but that didn't help much. At least one message is cached. There is also attribute MaximumHard, and it seems to be a solution, but unfortunately 0 means that there is no limit for number of messages stored in cache. That is a terrible thing for me, becouse that means that there is no way to prevent cache from caching messages.
      My messages are very important, it is unacceptable to loose even one, for example when lack of electricity happens.

      Is my way of thinking correct?
      Any solutions?

      Thank you for your replies in advance.


        • 1. Re: Message Cache configuration problem

          I don't think you understand how the MessageCache works.
          It plays no part in storing Persistent Messages.

          What it does do is to discard messages from memory (when memory is tight)
          that it is sure are in persistent storage and reload them when they are needed.

          That means it needs to store messages that are NOT persistent to move them
          out of memory. These have "TXOP=T" in the database. T meaning temporary.

          The number of Hard references are the number of working messages in memory
          (nothing to do with those that are persisted).
          i.e. It is the ones that are currently (or recently) being sent and received.

          If they are persistent, they will remain in the database until some client acknowledges
          receipt of the message.

          • 2. Re: Message Cache configuration problem

            JMS quarantees that a persistent message is either stored or you get
            an error message.

            The JBoss implementation looks like this (with some internal error handling removed
            and comments added in block captials):

            public class PersistentQueue extends org.jboss.mq.server.BasicQueue
            {
             public void addMessage(MessageReference mesRef, Tx txId) throws JMSException
             {
             // MAKE SURE THE MESSAGE IS PERSISTED FIRST
             if (mesRef.isPersistent())
             {
             try
             {
             server.getPersistenceManager().add(mesRef, txId);
             }
             catch (Throwable t)
             {
             // COULDN"T PERSIST IT, SO TELL THE CLIENT IT WASN"T SENT
             SpyJMSException.rethrowAsJMSException(error, t);
             }
             }
            
             // NOW WE ARE SURE IT IS PERSISTED, MAKE IT AVAILABLE IN THE QUEUE
             super.addMessage(mesRef, txId);
             }
            


            • 3. Re: Message Cache configuration problem
              vitor_b

              Hello

              Thank you very much for your replies.

              I need only a small confirmation. That all means that:

              1. Non persisted messages are stored in the same persistent storage like messages marked as persistent, when cache manager is out of memory
              2. Messages marked as persistent can be both: in memory (cache) and persistent storage at the same time
              3. When lack of electricity happens all non persistent messages from memory will be lost (stored non persistent ones will survive).

              Short answers like yes/no would be enought.

              Best regards

              vitor_b

              P.S. hard to be a beginner