Hi,
Is it possible to update datasource that SqlComponent refers to at runtime?
The datasource I want to update is bound to "TestDB" by registry in
CamelContext as follows:
BasicDataSource datasource = new BasicDataSource();
datasource.setUrl("jdbc:mysql://hostname/dbname?user=user&password=password");
registry.put("TestDB", datasource);
DSL using the datasource is:
<routes xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:hoge" />
<to uri="sql:SELECT * FROM test?dataSource=TestDB" />
<marshal>
<json library="Jackson" />
</marshal>
</route>
</routes>
This DSL is successfully executed, the SQL returning right results.
Next, I updated the datasource:
registry.put("TestDB", newDatasource);
Then I ran the DSL again, hoping that the DSL used the new datasource, but the
SQL used the old one.
I think I can update the datasource if I run the DSL after doing removeRoute
and AddRoute, but I don't want to do removeRoute and AddRoute due to
performance cost.
Are there any ways?