camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexey-s <alex...@mail.ru>
Subject OSGi JTA and NonXA DataSource
Date Sun, 08 Apr 2012 20:19:55 GMT
I use a camel running karaf. The data is stored in the database Oracle. From
the beginning I used OracleXADataSource. With increasing system performance
Oracle Server has often produce errors exceeding the number of connections.
For each transaction, JDBC driver creates a new connection to the Oracle
Server. Previously closed connections are not used in OracleXADataSource.
Oracle Server every 20 seconds, remove the connection closed. With a large
number of camel route overflow of allowable connections to Oracle Server.
I was looking for the option of using connection pooling. Found opens source
project Bitronix. Excellent functionality - LrcXADataSource. This
functionality is not running OSGi and Apache Aries. I reworked the
functional LrcXA classes to run on Apache Aries JTA.

Sample add XADataSource service:

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
  xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  default-activation="lazy">

  <bean id="oracleDataSource" class="oracle.jdbc.pool.OracleDataSource">
    <cm:managed-properties
      persistent-id="mydb.jdbc.oracle"
      update-strategy="component-managed"
      update-method="update"/>
  </bean>

  <bean id="lrcXADataSource"
class="bitronix.tm.resource.jdbc.lrc.LrcXADataSource">
    <property name="dataSource" ref="oracleDataSource"/>
  </bean>

 <service id="xaDataSource" ref="lrcXADataSource"
interface="javax.sql.XADataSource">
    <service-properties>
      <entry key="osgi.jndi.service.name" value="jdbc/mydb"/>
    </service-properties>
  </service>
    
</blueprint>

attach source code 
http://camel.465427.n5.nabble.com/file/n5626400/osgi-lrcxa.tar.gz
osgi-lrcxa.tar.gz 

--
View this message in context: http://camel.465427.n5.nabble.com/OSGi-JTA-and-NonXA-DataSource-tp5626400p5626400.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message