activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Lidgate <Chris.Lidg...@Sun.COM>
Subject [Fwd: How to add a custom persistence adapter]
Date Fri, 13 Feb 2009 15:25:56 GMT
Hi

I'm playing around with ActiveMQ v5.2.0 and would like to investigate 
different types of persistence adapter. To this end I've tried to create 
my own, but I'm having problems.

1) I've taken the current 5.2.0 source and compiled it under maven. This 
works OK.

2) I've added a new package to activemq-core - called 
org/apache/activemq/store/chris . I copied all of the files from 
org/apache/activemq/store/memory/* into my new package, then refactored 
them with appropriate names. I can re-build this with maven and it works 
OK. I can see my new classes in the jar file

jar tvf lib/activemq-core-5.2.0.jar | grep -i chris
     0 Thu Feb 12 15:15:06 GMT 2009 org/apache/activemq/store/chris/
  5645 Thu Feb 12 15:14:54 GMT 2009 
org/apache/activemq/store/chris/ChrisMessageStore.class
  6938 Thu Feb 12 15:14:56 GMT 2009 
org/apache/activemq/store/chris/ChrisPersistenceAdapter.class
  6920 Thu Feb 12 15:14:56 GMT 2009 
org/apache/activemq/store/chris/ChrisTopicMessageStore.class
  3272 Thu Feb 12 15:14:54 GMT 2009 
org/apache/activemq/store/chris/ChrisTopicSub.class
  1759 Thu Feb 12 15:14:56 GMT 2009 
org/apache/activemq/store/chris/ChrisTransactionStore$1.class
  1789 Thu Feb 12 15:14:56 GMT 2009 
org/apache/activemq/store/chris/ChrisTransactionStore$2.class
  1579 Thu Feb 12 15:14:56 GMT 2009 
org/apache/activemq/store/chris/ChrisTransactionStore$3.class
  1602 Thu Feb 12 15:14:56 GMT 2009 
org/apache/activemq/store/chris/ChrisTransactionStore$4.class
   460 Thu Feb 12 15:14:56 GMT 2009 
org/apache/activemq/store/chris/ChrisTransactionStore$AddMessageCommand.class
   472 Thu Feb 12 15:14:56 GMT 2009 
org/apache/activemq/store/chris/ChrisTransactionStore$RemoveMessageCommand.class
  3793 Thu Feb 12 15:14:56 GMT 2009 
org/apache/activemq/store/chris/ChrisTransactionStore$Tx.class
  6520 Thu Feb 12 15:14:56 GMT 2009 
org/apache/activemq/store/chris/ChrisTransactionStore.class

3) If I add the memory persistence adapter to the activemq.xml file and 
run the server, the server runs fine. I can see that the memory model is 
being run as the server runs ~ 10x faster than the stock server when 
handling persistent messages.

4) However if I change the activemq.xml file to use my chris persistence 
adapter the server will not run and throws the following exception

bin/activemq

Listening for transport dt_socket at address: 5005
ACTIVEMQ_HOME: /home/user/tmp/activemq-chris
ACTIVEMQ_BASE: /home/user/tmp/activemq-chris
Loading message broker from: xbean:activemq.xml
ERROR: java.lang.RuntimeException: Failed to execute start task. Reason: 
org.springframework.beans.factory.BeanDefinitionStoreException: 
Unrecognized xbean element mapping: chrisPersistenceAdapter in namespace 
http://activemq.apache.org/schema/core
java.lang.RuntimeException: Failed to execute start task. Reason: 
org.springframework.beans.factory.BeanDefinitionStoreException: 
Unrecognized xbean element mapping: chrisPersistenceAdapter in namespace 
http://activemq.apache.org/schema/core
    at 
org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:98)
    at 
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
    at 
org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:129)
    at 
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
    at 
org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:79)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.activemq.console.Main.runTaskClass(Main.java:225)
    at org.apache.activemq.console.Main.main(Main.java:106)
Caused by: 
org.springframework.beans.factory.BeanDefinitionStoreException: 
Unrecognized xbean element mapping: chrisPersistenceAdapter in namespace 
http://activemq.apache.org/schema/core
    at 
org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parseBeanFromExtensionElement(XBeanNamespaceHandler.java:273)
    at 
org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parse(XBeanNamespaceHandler.java:155)
    at 
org.apache.xbean.spring.context.v2.XBeanNamespaceHandler.parse(XBeanNamespaceHandler.java:49)
    at 
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1255)
    at 
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1245)
    at 
org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parseChildExtensionBean(XBeanNamespaceHandler.java:763)
    at 
org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parseNestedPropertyViaIntrospection(XBeanNamespaceHandler.java:599)
    at 
org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.tryParseNestedPropertyViaIntrospection(XBeanNamespaceHandler.java:566)
    at 
org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.addNestedPropertyElements(XBeanNamespaceHandler.java:535)
    at 
org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parseBeanFromExtensionElement(XBeanNamespaceHandler.java:226)
    at 
org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parseBeanFromExtensionElement(XBeanNamespaceHandler.java:271)
    at 
org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parse(XBeanNamespaceHandler.java:155)

[ ... snip ... ]

5) From some digging on the web I've seen the following thread which 
seems to describe a similar problem

    http://www.mail-archive.com/dev@activemq.apache.org/msg01191.html

However I don't understand what the response is saying (I don't grok 
xbean at all :-(. I tried to put in this xml

 <build>
   <plugins>
     <plugin>
       <groupId>org.apache.xbean</groupId>
       <artifactId>maven-xbean-plugin</artifactId>
       <executions>
         <execution>
           <configuration>
             <namespace>http://activemq.org/chris/1.0 <http://activemq.org/bdb/1.0></namespace>
           </configuration>
           <goals>
             <goal>mapping</goal>
           </goals>
         </execution>
       </executions>
     </plugin>
   </plugins>
 </build>


into the pom.xml file (at the top of the activemq source tree), but then 
the maven build failed. I also failed to understand how the namespace 
declared above had any linkage to my package (which was 
org.apache.acticemq.store.chris).


Yours, very confused.



-- Chris







Mime
View raw message