<!--
Database-specific, non-pooling, non-enlisting javax.sql.XADataSource
-->
<bean id="postgresql" class="org.postgresql.xa.PGXADataSource">
<property name="url" value="jdbc:postgresql://localhost:5432/reportdb" />
<property name="user" value="fuse" />
<property name="password" value="fuse" />
<property name="currentSchema" value="report" />
<property name="connectTimeout" value="5" />
</bean>
<!--
Expose database-specific data source with service properties
No need to expose pooling, enlisting, non database-specific javax.sql.DataSource - it'll be registered
automatically by pax-jdbc-config with the same properties as this <service>, but with higher service.ranking
-->
<service id="pool" ref="postgresql" interface="javax.sql.XADataSource">
<service-properties>
<!-- "pool" key is needed for pax-jdbc-config to wrap database-specific data source inside connection pool -->
<entry key="pool" value="transx" />
<!-- <service>/@id attribute doesn't propagate, but name of the datasource is required using one of: -->
<entry key="osgi.jndi.service.name" value="jdbc/postgresql" />
<!-- or: -->
<!--<entry key="dataSourceName" value="jdbc/postgresql" />-->
<!-- Other properties, that normally are needed by e.g., pax-jdbc-pool-transx -->
<entry key="pool.maxPoolSize" value="13" />
<entry key="pool.userName" value="fuse" />
<entry key="pool.password" value="fuse" />
</service-properties>
</service>
<!--
Database-specific, non-pooling, non-enlisting javax.sql.XADataSource
-->
<bean id="postgresql" class="org.postgresql.xa.PGXADataSource">
<property name="url" value="jdbc:postgresql://localhost:5432/reportdb" />
<property name="user" value="fuse" />
<property name="password" value="fuse" />
<property name="currentSchema" value="report" />
<property name="connectTimeout" value="5" />
</bean>
<!--
Expose database-specific data source with service properties
No need to expose pooling, enlisting, non database-specific javax.sql.DataSource - it'll be registered
automatically by pax-jdbc-config with the same properties as this <service>, but with higher service.ranking
-->
<service id="pool" ref="postgresql" interface="javax.sql.XADataSource">
<service-properties>
<!-- "pool" key is needed for pax-jdbc-config to wrap database-specific data source inside connection pool -->
<entry key="pool" value="transx" />
<!-- <service>/@id attribute doesn't propagate, but name of the datasource is required using one of: -->
<entry key="osgi.jndi.service.name" value="jdbc/postgresql" />
<!-- or: -->
<!--<entry key="dataSourceName" value="jdbc/postgresql" />-->
<!-- Other properties, that normally are needed by e.g., pax-jdbc-pool-transx -->
<entry key="pool.maxPoolSize" value="13" />
<entry key="pool.userName" value="fuse" />
<entry key="pool.password" value="fuse" />
</service-properties>
</service>
Copy to ClipboardCopied!Toggle word wrapToggle overflow
使用蓝图中的这个 JMS 配置(mind pool=transx):
<!--
Broker-specific, non-pooling, non-enlisting javax.jms.XAConnectionFactory
-->
<bean id="artemis" class="org.apache.activemq.artemis.jms.client.ActiveMQXAConnectionFactory">
<argument index="0" value="tcp://localhost:61616" />
<!-- credentials needed for JCA-based XA-recovery -->
<argument index="1" value="admin" />
<argument index="2" value="admin" />
<property name="callTimeout" value="2000" />
<property name="initialConnectAttempts" value="3" />
</bean>
<!--
Expose broker-specific connection factory with service properties
No need to expose pooling, enlisting, non broker-specific javax.jms.XAConnectionFactory - it'll be registered
automatically by pax-jms-config with the same properties as this <service>, but with higher service.ranking
-->
<service id="pool" ref="artemis" interface="javax.jms.XAConnectionFactory">
<service-properties>
<!-- "pool" key is needed for pax-jms-config to wrap broker-specific connection factory inside connection pool -->
<entry key="pool" value="transx" />
<!-- <service>/@id attribute doesn't propagate, but name of the connection factory is required using one of: -->
<entry key="osgi.jndi.service.name" value="jms/artemis" />
<!-- or: -->
<!--<entry key="name" value="jms/artemis" />-->
<!-- Other properties, that normally are needed e.g., pax-jms-pool-transx -->
<entry key="pool.maxPoolSize" value="13" />
<entry key="pool.userName" value="admin" />
<entry key="pool.password" value="admin" />
</service-properties>
</service>
<!--
Broker-specific, non-pooling, non-enlisting javax.jms.XAConnectionFactory
-->
<bean id="artemis" class="org.apache.activemq.artemis.jms.client.ActiveMQXAConnectionFactory">
<argument index="0" value="tcp://localhost:61616" />
<!-- credentials needed for JCA-based XA-recovery -->
<argument index="1" value="admin" />
<argument index="2" value="admin" />
<property name="callTimeout" value="2000" />
<property name="initialConnectAttempts" value="3" />
</bean>
<!--
Expose broker-specific connection factory with service properties
No need to expose pooling, enlisting, non broker-specific javax.jms.XAConnectionFactory - it'll be registered
automatically by pax-jms-config with the same properties as this <service>, but with higher service.ranking
-->
<service id="pool" ref="artemis" interface="javax.jms.XAConnectionFactory">
<service-properties>
<!-- "pool" key is needed for pax-jms-config to wrap broker-specific connection factory inside connection pool -->
<entry key="pool" value="transx" />
<!-- <service>/@id attribute doesn't propagate, but name of the connection factory is required using one of: -->
<entry key="osgi.jndi.service.name" value="jms/artemis" />
<!-- or: -->
<!--<entry key="name" value="jms/artemis" />-->
<!-- Other properties, that normally are needed e.g., pax-jms-pool-transx -->
<entry key="pool.maxPoolSize" value="13" />
<entry key="pool.userName" value="admin" />
<entry key="pool.password" value="admin" />
</service-properties>
</service>
Copy to ClipboardCopied!Toggle word wrapToggle overflow