You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by seb55555 <s....@aaa-data.fr> on 2011/11/04 15:33:49 UTC

Activate JMS persistence on TomEE

Hello,

I have a problem to activate persistence with embedded activemq on TomEE.

This is the conf I use in openejb.xml




But this seems doesn't work.


So, I tried to configure the broker with xbean like this :



But this way, the broker doesn't start at all.


What is the good way to configure the broker with JMS persistence in TomEE ?

Thanks

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

Re: Activate JMS persistence on TomEE

Posted by seb55555 <s....@aaa-data.fr>.
Thank you for your answers.

I have to put this subject in standby for a while but i will try to use your
configuration as soon as possible (maybe next week, i hope).

I'll let you know.

Sébastien

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

Re: Activate JMS persistence on TomEE

Posted by AndyG <an...@orprovision.com>.
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.

Re: Activate JMS persistence on TomEE

Posted by David Blevins <da...@gmail.com>.
On Nov 4, 2011, at 7:33 AM, seb55555 wrote:

> So, I tried to configure the broker with xbean like this :

The "BrokerXmlConfig = xbean:path/to/activemq.xml" approach does work, but you have to add some libraries to get them to work.

At minimum:

  - xbean-spring
  - spring

That might be it, not sure.  Some verification would great for anyone who uses it.

We have a test in the build that uses that style and reruns some basic JMS tests:

  container/openejb-core/src/test/java/org/apache/openejb/core/mdb/AmqXmlTest.java

Some documentation on that would be excellent.  An accurate list of jars and links to maven central would be useful.

We could maybe even make an xbean-brokerconfig zip file in the build or something for people to download.


-David


Re: Activate JMS persistence on TomEE

Posted by Romain Manni-Bucau <rm...@gmail.com>.
you shouldn't use both xml config and server url. Just one is enough.

brokerxmlconfig is a activemq xml or properties config file path not an uri.

you can redirect your question to activemq mailing too

- Romain


2011/11/4 seb55555 <s....@aaa-data.fr>

> I tried with
>                BrokerXmlConfig =
> broker:(tcp://localhost:61616)?useJmx=false
>                ServerUrl =
> vm://localhost?broker.persistent=true&amp;async=true
>                DataSource My Unmanaged DataSource
>
> But this doesn't seem to work (no activemq-data file created)
>
> Then i tried with
>                BrokerXmlConfig = broker:(tcp://0.0.0.0:61616)?useJmx=false
>                ServerUrl = vm://
> 0.0.0.0?broker.persistent=true&amp;async=true
>                DataSource = My Unmanaged DataSource
>
> It create activemq-data (kahadb) dir.
> But :
> 1- Message are not reveive by subscriber anymore
> 2- It doesn't use the datasource "My Unmanaged DataSource" but kahadb
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Activate-JMS-persistence-on-TomEE-tp3990276p3990713.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: Activate JMS persistence on TomEE

Posted by seb55555 <s....@aaa-data.fr>.
I tried with
		BrokerXmlConfig = broker:(tcp://localhost:61616)?useJmx=false
		ServerUrl = vm://localhost?broker.persistent=true&amp;async=true
		DataSource My Unmanaged DataSource

But this doesn't seem to work (no activemq-data file created)

Then i tried with
		BrokerXmlConfig = broker:(tcp://0.0.0.0:61616)?useJmx=false
		ServerUrl = vm://0.0.0.0?broker.persistent=true&amp;async=true
		DataSource = My Unmanaged DataSource

It create activemq-data (kahadb) dir.
But :
1- Message are not reveive by subscriber anymore
2- It doesn't use the datasource "My Unmanaged DataSource" but kahadb


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

Re: Activate JMS persistence on TomEE

Posted by Romain Manni-Bucau <rm...@gmail.com>.
you don't have an activemq-data file?

i thought in the uri the parameter was prefixed by broker: vm://localhost?*
broker*.*persistent*=*true for instance.*

- Romain


2011/11/4 seb55555 <s....@aaa-data.fr>

> This is my conf (it was in raw text. That's why you don't see it in gmail).
>
> <Resource id="MyJmsResourceAdapter" type="ActiveMQResourceAdapter">
>                BrokerXmlConfig = broker:(tcp://0.0.0.0:61616
> )?persistent=true
>
>                ServerUrl vm://localhost?async=true
>
>                DataSource My Unmanaged DataSource
> </Resource>
>
> <Resource id="MyJmsConnectionFactory" type="javax.jms.ConnectionFactory">
>        ResourceAdapter MyJmsResourceAdapter
> </Resource>
>
>  <Container id="MyJmsMdbContainer" ctype="MESSAGE">
>        ResourceAdapter MyJmsResourceAdapter
> </Container>
>
>
> And the second with xbean :
>
> BrokerXmlConfig =
>
> xbean:file:///C:/outils/apache-tomee-webprofile-1.0.0-beta-1/conf/activemq.xml
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Activate-JMS-persistence-on-TomEE-tp3990276p3990411.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: Activate JMS persistence on TomEE

Posted by seb55555 <s....@aaa-data.fr>.
This is my conf (it was in raw text. That's why you don't see it in gmail).

<Resource id="MyJmsResourceAdapter" type="ActiveMQResourceAdapter">
        	BrokerXmlConfig = broker:(tcp://0.0.0.0:61616)?persistent=true
	
		ServerUrl vm://localhost?async=true

		DataSource My Unmanaged DataSource
</Resource>

<Resource id="MyJmsConnectionFactory" type="javax.jms.ConnectionFactory">
        ResourceAdapter MyJmsResourceAdapter
</Resource>

 <Container id="MyJmsMdbContainer" ctype="MESSAGE">
        ResourceAdapter MyJmsResourceAdapter
</Container>


And the second with xbean :

BrokerXmlConfig =
xbean:file:///C:/outils/apache-tomee-webprofile-1.0.0-beta-1/conf/activemq.xml 


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

Re: Activate JMS persistence on TomEE

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi,

i don't know if it is gmail but i don't see your conf.

here is how to configure the activemq broker through the
activemqresourceadatper:

http://openejb.apache.org/containers-and-resources.html
you can specify a activems.xml file. To activate the persistence see
http://activemq.apache.org/persistence.html

- Romain


2011/11/4 seb55555 <s....@aaa-data.fr>

> Hello,
>
> I have a problem to activate persistence with embedded activemq on TomEE.
>
> This is the conf I use in openejb.xml
>
>
>
>
> But this seems doesn't work.
>
>
> So, I tried to configure the broker with xbean like this :
>
>
>
> But this way, the broker doesn't start at all.
>
>
> What is the good way to configure the broker with JMS persistence in TomEE
> ?
>
> Thanks
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Activate-JMS-persistence-on-TomEE-tp3990276p3990276.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>