I need another repository besides the default one.
Its role is to be an archive of old documents.
I have defined it as a contribution:
<repository name="documentArchive" factory="org.nuxeo.ecm.core.storage.sql.ra.PoolingRepositoryFactory">
<repository sendInvalidationEvents="true">
<xa-datasource>org.postgresql.xa.PGXADataSource</xa-datasource>
<property name="ServerName">127.0.0.1</property>
<property name="PortNumber">5432</property>
<property name="DatabaseName">nuxeo_archive</property>
<property name="User">nuxeo</property>
<property name="Password">nuxeo</property>
</repository>
</repository>
I have made the nuxeo_archive database to hold this.
What I acctualy wanted was to put this in a specific database schema in the same database as the default repository so they can share the connection. But I could not find a way to define it like this.
/>
Is this possible?
I like the Single-Datasource Mode that comes as default for all connections and I would like to stick to it.
Without this I need to fall back to XA transactions that I try to avoid.
Another aproach that I have been looking into is to use the single datasource mode with an exclusion on documentArchive and use compensation on failed transactions to documentArhive.
In nuxeo.conf I have put:
nuxeo.db.singleDataSource.exclude=repository_documentArchive
but I get this exception when the default respository connection is beeing closed:
ERROR [http-bio-0.0.0.0-8080-exec-5] [org.nuxeo.ecm.core.storage.sql.jdbc.JDBCLogger] (5) SQL: XA end error on org.apache.geronimo.transaction.manager.XidImpl@76c188fa
java.lang.NullPointerException
at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCMapper.end(JDBCMapper.java:1317)
at org.nuxeo.ecm.core.storage.sql.SoftRefCachingMapper.end(SoftRefCachingMapper.java:182)
at org.nuxeo.ecm.core.storage.sql.SessionImpl.end(SessionImpl.java:1430)
at org.nuxeo.ecm.core.storage.sql.ra.ConnectionAwareXAResource.end(ConnectionAwareXAResource.java:59)
Questions:
- How should I define both repositories to use the same datasource but different database schemas so I can use non-XA datasources ?
- Is it something wrong on how I try to use the "nuxeo.db.singleDataSource.exclude" option?