tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From AndyG <andy.gumbre...@orprovision.com>
Subject Re: Activate JMS persistence on TomEE
Date Wed, 09 Nov 2011 08:10:59 GMT
Been meaning to post this for a few days. I will try and get time for a blog.

I have been using ActiveMQ JMS from the get go and have tuned it as much as
I need, which may be more or less than your own requirements. ActiveMQ
documentation is a book that needs to read.

These are my is my openejb.xml entries:

<Resource id="JMSResourceAdapter" type="ActiveMQResourceAdapter">
		*BrokerXmlConfig xbean:file:conf/activemq.xml*
		ServerUrl
failover:(nio://localhost:54545?soTimeout=60000&amp;daemon=true&amp;keepAlive=true&amp;connectionTimeout=120000&amp;wireFormat.tcpNoDelayEnabled=true&amp;wireFormat.maxInactivityDuration=240000&amp;wireFormat.maxInactivityDurationInitalDelay=120000)?timeout=10000
	</Resource>
	
	<Connector id="JMSConnectionFactory" type="javax.jms.ConnectionFactory">
		ResourceAdapter JMSResourceAdapter
		TransactionSupport none
		PoolMaxSize 150
		PoolMinSize 0
		ConnectionMaxWaitMilliseconds 15000
		ConnectionMaxIdleMinutes 15
	</Connector>

This is my activemq.xml as referenced above as '*BrokerXmlConfig
xbean:file:conf/activemq.xml*', I have included an optional DataSource
configuration, but currently use KahaDB in production:

<beans
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:amq="http://activemq.apache.org/schema/core"
    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-2.0.xsd
  http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core-5.5.0.xsd">


  
  <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="location">
      <value>*file:conf/activemq.properties*</value>
    </property>
    <property name="properties">
      <props>
	<prop key="data.dir">data</prop>
        <prop key="conf.db.host">localhost:5432</prop>
        <prop key="conf.db.un">myuser</prop>
        <prop key="conf.db.pw">mypassword</prop>
      </props>
    </property>
  </bean>

  <broker xmlns="http://activemq.apache.org/schema/core"
          useJmx="true"
          brokerName="spectrum"
          useShutdownHook="false"
          persistent="true"
          start="false"
          schedulerSupport="false"
          enableStatistics="false">

    
	
	<persistenceAdapter>
      <kahaDB directory="${data.dir}/activemq-data/kaha"
ignoreMissingJournalfiles="true" checkForCorruptJournalFiles="true"
checksumJournalFiles="true"/>
    </persistenceAdapter>

    
    <transportConnectors>
      <transportConnector name="nio"
uri="nio://0.0.0.0:54545?enableStatusMonitor=true&amp;soTimeout=60000&amp;daemon=true&amp;keepAlive=true&amp;connectionTimeout=120000&amp;wireFormat.tcpNoDelayEnabled=true&amp;wireFormat.maxInactivityDuration=240000&amp;wireFormat.maxInactivityDurationInitalDelay=120000"/>
    </transportConnectors>

  </broker>

  <bean id="postgresql-activemq-ds"
class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="org.postgresql.Driver"/>
    <property name="url"
value="jdbc:postgresql://${conf.db.host}/openejb_activemq"/>
    <property name="username" value="${conf.db.un}"/>
    <property name="password" value="${conf.db.pw}"/>
    <property name="poolPreparedStatements" value="true"/>
  </bean>

</beans>

These are the libraries I am using in the *[openejb]/lib* directory. The
versions are obviously distribution specific, but can found in the ActiveMQ
and OpenEJB distributions:

activeio-core-3.1.2.jar
activemq-core-5.6-SNAPSHOT.jar
activemq-protobuf-1.1.jar
activemq-ra-5.6-SNAPSHOT.jar
kahadb-5.6-SNAPSHOT.jar
spring-aop-3.0.5.RELEASE.jar
spring-asm-3.0.5.RELEASE.jar
spring-beans-3.0.5.RELEASE.jar
spring-context-3.0.5.RELEASE.jar
spring-core-3.0.5.RELEASE.jar
spring-expression-3.0.5.RELEASE.jar
xbean-spring-3.8.jar

At the time of writing you can find the *xbean-spring-3.8.jar* here:

http://repo1.maven.org/maven2/org/apache/xbean/xbean-spring/3.8/

Have fun,

Andy.



--
View this message in context: http://openejb.979440.n4.nabble.com/Activate-JMS-persistence-on-TomEE-tp3990276p4019013.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Mime
View raw message