I am using Jdbc resource adaptor 7.1.15 in my SBB. It is working well with single Datasource. Now I have a requirement to talk to a second datasource from inside my SBB, but I couldn't find a way to do that.
I tried updating resource-adaptor-jar.xml in resources/jdbc/ra/src/main/resources/META-INF/. by adding another config property for DATASOURCE_JNDI_NAME.like below
<resource-adaptor ignore-ra-type-event-type-check="True">
<resource-adaptor-name>JdbcResourceAdaptor</resource-adaptor-name>
<resource-adaptor-vendor>org.restcomm</resource-adaptor-vendor>
<resource-adaptor-version>1.0</resource-adaptor-version>
<resource-adaptor-type-ref>
<resource-adaptor-type-name>JDBCResourceAdaptorType</resource-adaptor-type-name>
<resource-adaptor-type-vendor>org.restcomm</resource-adaptor-type-vendor>
<resource-adaptor-type-version>1.0</resource-adaptor-type-version>
</resource-adaptor-type-ref>
<resource-adaptor-classes>
<resource-adaptor-class>
<resource-adaptor-class-name>
org.restcomm.slee.resource.jdbc.JdbcResourceAdaptor
</resource-adaptor-class-name>
</resource-adaptor-class>
</resource-adaptor-classes>
<config-property>
<config-property-name>DATASOURCE_JNDI_NAME</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>java:/ExampleDS</config-property-value>
</config-property>
<config-property>
<config-property-name>DATASOURCE_JNDI_NAME</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>java:/ExampleDS_2</config-property-value>
</config-property>
<config-property>
<config-property-name>EXECUTOR_SERVICE_THREADS</config-property-name>
<config-property-type>java.lang.Integer</config-property-type>
<config-property-value>4</config-property-value>
</config-property>
<config-property>
<config-property-name>RA_SBB_INTERFACE_CONNECTION_GETTERS_ON</config-property-name>
<config-property-type>java.lang.Boolean</config-property-type>
<config-property-value>true</config-property-value>
</config-property>
</resource-adaptor>
but as soon as I deploy it I get deploy errors. My question is, Is there a way to configure jdbc RA to use two or more Datasources at the same time?
In order to have multiple data sources for the Restcomm SLEE Jdbc resource adaptor you need to firstly change your resource-adaptor-jar.xml and deploy-config.xml files in the restcomm-slee-ra-jdbc and restcomm-slee-ra-jdbc-DU projects, respectively. Here is an example of the resource-adaptor-jar.xml where two JdbcResourceAdaptors are defined. One for each data source.
Then the deploy-config.xml needs to be updated with the entity names. In my case I created the entity names JDBCRA and JDBCRA-Config. JDBCRA would be the data source for the application statistics and JDBCRA-Config would be the data source for the application configuration.
Then update the standalone.xml for the WildFly App server (restcomm-slee-7.1.83.87-wildfly-10.1.0.Final) to include the two data sources:
Secondly, in your JAIN-SLEE application define two SBBs, namely StatsDataSourceSBB and ConfigDataSourceSBB. In the sbb-jar.xml of the JAIN-SLEE application configure each SBB as follows:
That should allow you to define multiple data source to your Restcomm JAIN-SLEE JDBC RA.
Hope this helps.