3 Replies Latest reply on Nov 11, 2016 5:52 AM by A F

    Configuring my activeMQ instance to use Oracle DB for Persistence

    Stephen Allen Newbie



      I currently have an activeMQ broker that I'm running in a Fuse/Fabric container and it's working fine.  I'd like to set up my broker to use an Oracle DB to persist to, but I'm having trouble working out the best way to do this.  I couldn't find any real examples or tutorials of how to do this on the web, all the examples I could find were of setting up PersistenceAdapters, etc. in standalone instances of ActiveMQ.


      Has anyone successfully configured an ActiveMQ broker that's been created in and managed by Fuse to use an Oracle DB for persistence?


      As a quick test I tried editing the default activemq.xml that's in /etc/ so that it uses an Oracle Persistence Adapter:-


                  dataDirectory="${activemq.base}/data" dataSource="#oracleDS"/>


      But it seems to do nothing, no errors in the logs, no extra tables, etc. appearing in the oracle db.


      If my persistenceAdapter wasn't working should I be seeing errors in the container's logs?  If it is working, where would I look in the Oracle DB to check for messages persisting?


      Is setting up persistence in activemq.xml the best way to configure this sort of thing and if it is can I point an instance of a broker to a specific activemq.xml (as opposed to editing the default one!).


      I also noticed that there is a 'Persistence Adapter' folder in the Properties tree of my broker when I look at it in the Fuse Management Console.  Is there any way I can create a new PersistenceAdapter in the MC or on the command line, or is this just reflecting info it found in the activemq.xml file?



        • 1. Re: Configuring my activeMQ instance to use Oracle DB for Persistence
          A F Newbie

          Hi Stephen,

          In the corresponding broker profile create file broker.xml to override and keep intact default broker.xml from mq-broker profile.

          Add this bean into new broker.xml:

               <bean id="oracle-ds" class="oracle.jdbc.pool.OracleDataSource" destroy-method="close">

                  <property name="URL" value="jdbc:oracle:thin:@orcl-host:1521:orcl"/>

                  <property name="user" value="usr"/>

                  <property name="password" value="pwd"/>

                  <property name="connectionCachingEnabled" value="true"/>  


          Instead of:


                      <kahaDB directory="${data}/kahadb"/>




                      <jdbcPersistenceAdapter dataSource="#oracle-ds" />


          Besides that add:

          bundle.wrap\:mvn\:com.oracle/ojdbc7/ = wrap:mvn:com.oracle/ojdbc7/

          to io.fabric8.agent.properties in the broker profile.

          • 2. Re: Configuring my activeMQ instance to use Oracle DB for Persistence
            Stephen Allen Newbie

            Thanks A.F. I'll give this a go.


            When you say 'In the corresponding broker profile create file broker.xml' do you mean from inside the fuse console? e.g. using profile-edit ?  Or do you mean creating a physical file that should be put in a certain folder?