Hi Matthew,
pax-jdbc-pool-dbcp2 as well as pax-jdbc-pool-aries should both be able
to provide XA enlisting poolable DataSources.
Aries JPA and Transaction actually use the above in their integration
tests. So they should work together nicely.
I got two tutorials that both use XA transactions with Aries:
http://liquid-reality.de/display/liquid/2015/06/30/Apache+Karaf+Tutorial+part+10+-+Declarative+services
http://liquid-reality.de/display/liquid/2015/03/05/Apache+Karaf+Tutorial+Part+9+-+Annotation+based+blueprint+and+JPA
Btw. Do you plan to use blueprint or DS?
Christian
On 03.09.2015 22:51, [email protected] wrote:
Ok, maybe I can answer my own questions here, but if I could get some
confirmation that would be great. I seem to have a working system running
with ops4j-pax-jdbc-pool-aries rather than dbcp2.
Digging into the code in org.apache.aries.transaction.jdbc it looks like
RecoverableDataSource is the wrapper for my XADataSources and it does indeed
appear to support passing of pooling options onto ConnectionManagerFactory
which itself appears to use the pooling capabilities that come from the
Geronimo bundles. Does all this sound correct so far?
So, it's not dbcp2, but it's pooling nonetheless and I can adjust
preferences by passing the appropriate bean options to my pax-jdbc service
with the 'pool.' prefix which will in-turn send those on to the
RecoverableDataSource instance. Sound ok still?
And finally, my eclipselink JTA datasource JNDI lookups are formatted with
filters for the 'aries.managed' property [1] to ensure that I get the aries
auto-enlisting DataSources.
So far, this is running my existing code ok with only two changes I had to
make:
1. Fixed ARIES-1171, but actually in the Tranql code as I was getting
connection errors and didn't see a logical place to fix it from an aries
class (using latest aries-transaction-jdbc from SVN). This required bringing
all the tranql source into my aries bundle and just removing the external
dependency. I didn't like doing that, but since that code hasn't changed in
a while and I'm still prototyping all this it was the path of least
resistance.
2. Changed RecoverableDataSource to not use empty strings by default for
username and password. Which seemed to be similar/related to the above and I
posted as ARIES-1376.
Thoughts and criticisms welcome. Thanks!
[1]
osgi:service/javax.sql.DataSource/(&(osgi.jndi.service.name=my-app-node1)(ar
ies.managed=true))
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Thursday, September 03, 2015 10:58 AM
To: [email protected]
Subject: Bundle set recommendations for JPA+JTA+Eclipselink Partitioning?
I am in the process of refactoring an existing JPA/Eclipselink-based
application to introduce Eclipselink's partitioning support for database
sharding. My current application runs quite well with pooled jdbc
connections via boncep.
However, with the sharded model there will be a number of entity types that
are Replicated to all shards and, as such, eclipselink will be doing writes
that span multiple jdbc connections. Per the eclipselink recommendations for
paritioning I would like to introduce JTA in order to enforce integrity
across commits that hit multiple partitions.
It seems like the ops4j-pax-jdbc bundles are designed to support XA/JTA and
it seems like there is a lot of XA support in the various aries bundles
(aries.transaction. and aries.jpa.). However, I'm not sure of what
combination of these bundles+configuration will provide what I am after.
Since many of these bundles seem to be designed/documented around general
JTA usage - like performing a transaction that spans JMS and JDBC - I'm not
confident if that model works with my particular use case.
To further add to this, I would like for my JDBC connections to be pooled
for performance. ops4j-pax-jdbc-pool-dbcp2 seems like a logical choice, but
again I'm not sure if it will play nicely with the transaction management
features from aries.
I think I have a working model of this, but I'm rather new to XA/JTA
especially from OSGi so I want to make sure I'm getting this correct. So, I
guess my questions are:
1. Can ops4j-pax-jdbc-pool and it's dbcp2 sibling work with
aries-jpa/transaction to pool and auto-enlist XADataSources?
2. If not, will ops4j-pax-jdbc-pool-aries work? And if so, can its pooling
semantics be configured? E.g. minIdle, maxIdle, etc.
3. If neither of the above works, is there a recommended set of bundles to
accomplish pooled XADataSources with eclipselink+JTA?
Thanks,
Matthew Pitts
Developer
Security Solutions Design & Automation
Wells Fargo Bank | Tel 336.608.3332 | Cell 336.202.3913 | Kernersville, NC |
MAC D9693-010
[email protected]
--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
http://www.talend.com