4 Replies Latest reply on Oct 18, 2006 4:44 AM by timfox

    Equivalent of null persistence in Jboss Messaging

      What is the equivalent of null persistence in JBoss Messaging. I don't want any persistence. In JBossMQ i could set up a null persistence

        • 1. Re: Equivalent of null persistence in Jboss Messaging
          timfox

          There is a task for this for 1.2.1: http://jira.jboss.com/jira/browse/JBMESSAGING-381

          If you vote for it, you might be able to bump it's priority.

          Or perhaps you could implement yourself and contribute - this is an easy task to do.

          • 2. NullPersistenceManager Implementation

            null-persistence-service.xml

            <?xml version="1.0" encoding="UTF-8"?>
            
            <!--
             Null persistence deployment descriptor.
             -->
            
            <server>
            
             <mbean code="org.jboss.messaging.core.plugin.NullPersistenceManager"
             name="jboss.messaging:service=PersistenceManager">
            
             </mbean>
            
            </server>


            =============================================

            NullPersistenceManager.java

            /*
             * JBoss, Home of Professional Open Source
             * Copyright 2005, JBoss Inc., and individual contributors as indicated
             * by the @authors tag. See the copyright.txt in the distribution for a
             * full listing of individual contributors.
             *
             * This is free software; you can redistribute it and/or modify it
             * under the terms of the GNU Lesser General Public License as
             * published by the Free Software Foundation; either version 2.1 of
             * the License, or (at your option) any later version.
             *
             * This software is distributed in the hope that it will be useful,
             * but WITHOUT ANY WARRANTY; without even the implied warranty of
             * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
             * Lesser General Public License for more details.
             *
             * You should have received a copy of the GNU Lesser General Public
             * License along with this software; if not, write to the Free
             * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
             * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
             */
            
            package org.jboss.messaging.core.plugin;
            
            
            import java.util.ArrayList;
            import java.util.List;
            
            import org.jboss.messaging.core.MessageReference;
            import org.jboss.messaging.core.tx.Transaction;
            import org.jboss.logging.Logger;
            
            import org.jboss.messaging.core.plugin.contract.PersistenceManager;
            
            
            
            import org.jboss.system.ServiceMBeanSupport;
            
            
            
            
            
            public class NullPersistenceManager extends ServiceMBeanSupport implements PersistenceManager
            {
             // Constants -----------------------------------------------------
            
             private static final Logger log = Logger.getLogger(NullPersistenceManager.class);
            
            
            
             // Static --------------------------------------------------------
            
             // Attributes ----------------------------------------------------
            
             private boolean trace = log.isTraceEnabled();
            
            
            
             // Constructors --------------------------------------------------
            
             public NullPersistenceManager() throws Exception
             {
            
             }
            
            
            
             // ServiceMBeanSupport overrides ---------------------------------
            
             protected void startService() throws Exception
             {
            
             log.debug(this + " started");
             }
            
             protected void stopService() throws Exception
             {
             log.debug(this + " stopped");
             }
            
             // PersistenceManager implementation -------------------------
            
             public Object getInstance()
             {
             return this;
             }
            
            
             public long reserveIDBlock(String counterName, int size) throws Exception
             {
            
             if (trace)
             {
             log.trace("Getting id block for counter: " + counterName + " ,size: " + size);
             }
            
             return 1;
            
            
             }
            
            
             public void updateReliableReferencesLoadedInRange(long channelID, long orderStart, long orderEnd) throws Exception
             {
             if (trace)
             {
             log.trace("Updating reliable references for channel " + channelID + " between " + orderStart + " and " + orderEnd);
             }
            
            
             }
            
             public int getNumberOfUnloadedReferences(long channelID) throws Exception
             {
             if (trace) { log.trace("getting number of unloaded references for channel [" + channelID + "]"); }
            
            
             return 0;
            
             }
            
            
             public List getMessages(List messageIds) throws Exception
             {
             if (trace)
             {
             log.trace("Getting batch of messages for " + messageIds);
             }
            
            
             return new ArrayList();
            
            
             }
            
            
            
             public void addReferences(long channelID, List references, boolean loaded) throws Exception
             {
            
             }
            
             public void removeReferences(long channelID, List references) throws Exception
             {
             if (trace) { log.trace(this + " Removing " + references.size() + " refs from channel " + channelID); }
            
            
             }
            
             public long getMinOrdering(long channelID) throws Exception
             {
             if (trace)
             {
             log.trace("Getting min ordering for channel " + channelID);
             }
            
            
             return 0;
            
            
             }
            
            
            
             public List getReferenceInfos(long channelID, long minOrdering, int number) throws Exception
             {
             if (trace)
             {
             log.trace("loading message reference info for channel " + channelID + " for " + number + " refs");
             }
            
             List refs = new ArrayList();
            
             return refs;
            
            
             }
            
             public void updateReferencesNotLoaded(long channelID, List references) throws Exception
             {
            
            
             if (trace)
             {
             log.trace("Updating references to not loaded for channel:" + channelID);
             }
            
            
             }
            
             public void addReference(long channelID, MessageReference ref, Transaction tx) throws Exception
             {
            
             }
            
             public void removeReference(long channelID, MessageReference ref, Transaction tx) throws Exception
             {
            
             }
            
             public void resetLoadedStatus(long channelID) throws Exception
             {
             if (trace) { log.trace("resetting all channel data for channel " + channelID); }
            
            
             }
            
            
             public List retrievePreparedTransactions() throws Exception
             {
            
            
             List transactions = new ArrayList();
            
             return transactions;
            
            
             }
            
            
            
             public String toString()
             {
             return "NullPersistenceManager[]";
             }
            
             public String getName()
             {
             return toString();
             }
            
            
            
            }



            =============================================
            Error during deployment

            006-10-17 22:21:29,578 ERROR [org.jboss.deployment.MainDeployer] could not create deployment: file:/C:/work/head/jboss-4.0.2/server/messaging/deploy/jboss-messaging.sar/null-persistence-service.xml
            org.jboss.deployment.DeploymentException: Class does not expose a management interface: java.lang.Object; - nested throwable: (javax.management.NotCompliantMBeanException: Class does not expose a management interface: java.lang.Object)
            at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:143)





            • 3. Re: Equivalent of null persistence in Jboss Messaging

               

              <?xml version="1.0" encoding="UTF-8"?>
              
              <!--
               Null persistence deployment descriptor.
              
              
               -->
              
              <server>
              
               <mbean code="org.jboss.messaging.core.plugin.NullPersistenceManager"
               name="jboss.messaging:service=PersistenceManager"
               xmbean-dd="xmdesc/NullPersistenceManager-xmbean.xml">
              
               </mbean>
              
              
              
              </server>




              ============================================

              NullPersistenceManager-xbean.xml

              <?xml version="1.0" encoding="UTF-8"?>
               <!DOCTYPE mbean PUBLIC
               "-//JBoss//DTD JBOSS XMBEAN 1.2//EN"
               "http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_2.dtd">
              
              
              
              <mbean>
               <description>A Null persistence manager</description>
               <class>org.jboss.messaging.core.plugin.NullPersistenceManager</class>
              
               <!-- Managed constructors -->
              
               <!-- Managed attributes -->
              
               <attribute access="read-only" getMethod="getInstance">
               <description>The instance to plug into the server peer</description>
               <name>Instance</name>
               <type>java.lang.Object</type>
               </attribute>
              
              
               <!-- Managed operations -->
              
               <operation>
               <description>JBoss Service lifecycle operation</description>
               <name>create</name>
               </operation>
              
               <operation>
               <description>JBoss Service lifecycle operation</description>
               <name>start</name>
               </operation>
              
               <operation>
               <description>JBoss Service lifecycle operation</description>
               <name>stop</name>
               </operation>
              
               <operation>
               <description>JBoss Service lifecycle operation</description>
               <name>destroy</name>
               </operation>
              
              </mbean>



              ====================================

              This removes the incomplete deployment:

              Is this the right implementation? Am i missing anything

              • 4. Re: Equivalent of null persistence in Jboss Messaging
                timfox

                Please read my previous post.

                As I said there is a task for this in 1.2.1, therefore is it is not currently implemented.