activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Smith <psm...@aconex.com>
Subject AMQ 4.1 and Spring XML beans
Date Mon, 03 Sep 2007 11:06:47 GMT
Confused!  This works (as expected):

   <amq:broker useJmx="true" persistent="true">
     <amq:persistenceAdapter>
   		<amq:jdbcPersistenceAdapter dataSource="#derby-ds"/>
  	</amq:persistenceAdapter>

     <amq:transportConnectors>
       <amq:transportConnector uri="tcp://localhost:0" />
     </amq:transportConnectors>
   </amq:broker>

But this doesn't which is sort of copied from the XML guide on the  
website:

   <amq:broker useJmx="true" persistent="true">
  	<amq:persistenceAdapter>
  		<journaledJDBC journalLogFiles="5" dataDirectory="$ 
{activemq.base}/activemq-data"  dataSource="#derby-ds"/>
  	</amq:persistenceAdapter>
  	
     <amq:transportConnectors>
       <amq:transportConnector uri="tcp://localhost:0" />
     </amq:transportConnectors>
   </amq:broker>

I get this error after starting up Spring:

Exception in thread "main"  
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: L 
ine 15 in XML document from class path resource [amq.xml] is invalid;  
nested exception is org.xml.sax.SAXParseException: cvc-complex-type. 
2.4.c: The matching wildcard is strict, but no declaration can be  
found for element 'journaledJDBC'.
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The  
matching wildcard is strict, but no declaration can be found for  
element 'journaledJDBC'.
	at  
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXPar 
seException(ErrorHandlerWrapper.java:236)

Now, after looking at the XML schema defined here:

http://people.apache.org/repository/org.apache.activemq/xsds/activemq- 
core-4.1-SNAPSHOT.xsd

The journaledJDBC doesn't match the XSD for the persistenceAdapator  
element, and so is of course complaining.  Is the XML docs on the  
ActiveMQ website out of date?

What I really want is an embedded AMQ broker using the _fastest_  
persistence mechanism possible.  I'm not so worried about lost  
messages or HA.  I just want to receive messages as fast as possible  
while a slower consumer processes them, and if the process exits, to  
hopefully come back and keep processing saved messages. (my app,  
Apache Pinpoint, is indexing log4j event objects received locally via  
sockets, so the Lucene indexing could be slower rate than reception  
during high volume and I'd rather not slow down the producer).

Complete Spring XML config follows:

<beans
   xmlns="http://www.springframework.org/schema/beans"
   xmlns:amq="http://activemq.org/config/1.0"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.springframework.org/schema/beans  
http://www.springframework.org/schema/beans/spring-beans.xsd
   http://activemq.org/config/1.0 http://people.apache.org/repository/ 
org.apache.activemq/xsds/activemq-core-4.1-SNAPSHOT.xsd">

   <!--  lets create an embedded ActiveMQ Broker -->
   <amq:broker useJmx="true" persistent="true">
<!--    <amq:persistenceAdapter>
   		<amq:jdbcPersistenceAdapter dataSource="#derby-ds"/>
  	</amq:persistenceAdapter>
  -->
  	<amq:persistenceAdapter>
  		<journaledJDBC journalLogFiles="5" dataDirectory="$ 
{activemq.base}/activemq-data"  dataSource="#derby-ds"/>
  	</amq:persistenceAdapter>
  	
     <amq:transportConnectors>
       <amq:transportConnector uri="tcp://localhost:0" />
     </amq:transportConnectors>
   </amq:broker>

    <!--  ActiveMQ destinations to use  -->
   <amq:queue id="destination"   
physicalName="pinpointBufferedEventQueue"/>

   <!-- JMS ConnectionFactory to use, configuring the embedded broker  
using XML -->
   <amq:connectionFactory id="jmsFactory" brokerURL="vm://localhost"/>

   <!-- Spring JMS Template -->
   <bean id="jmsTemplate"  
class="org.springframework.jms.core.JmsTemplate">
     <property name="connectionFactory">
       <!-- lets wrap in a pool to avoid creating a connection per  
send -->
       <bean  
class="org.springframework.jms.connection.SingleConnectionFactory">
         <property name="targetConnectionFactory">
           <ref local="jmsFactory" />
         </property>
       </bean>
     </property>

     <property name="defaultDestination" ref="destination" />
   </bean>


   <bean id="derby-ds" class="org.apache.derby.jdbc.EmbeddedDataSource">
     <property name="databaseName" value="derbydb"/>
     <property name="createDatabase" value="create"/>
   </bean>

</beans>

Yours in Spring/XML/AMQ4.1x ignorance,

cheers,

Paul Smith
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message