FAQ
Camel look up the DataSource object from the camel context registry.
If you can change the registry dynamically, you can change the data source for the camel-jdbc component just as you said in the first mail.

The key point is you need to replace the old CamelContext Registry by a new CompositeRegistry just as CAMEL-8048[1] does.

[1]https://issues.apache.org/jira/browse/CAMEL-8048

--
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem


On November 21, 2014 at 4:52:41 AM, Camel Guy (camel@devguy.com) wrote:
Thanks Willem.

I can make that work! It's just a headache to get a new data source
instance initialized with data that is in Exchange. (Very dynamic data
source..)

Maybe I should instead be asking for the ability to pass a datasource
to the jdbc component via a header.
On Wed, Nov 19, 2014 at 11:07 PM, Willem Jiang wrote:
You can define a factory bean to instantiate the data source.
When the object export with the name A, camel can look it up from the Spring application context.
--
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem


On November 20, 2014 at 1:21:38 PM, Camel Guy (camel@devguy.com) wrote:
Hello,

I was wondering if a route could invoke a bean (or run, say, a groovy
script) that registered a new datasource.

Something like:

route ::
1) Instantiate datasource
2) Add datasource instance to the registry under key A
3) recipientList("jdbc:A?...")

This datasource needs to be created long after Camel starts up.

I'm using Spring XML.


Thank you,
~cg

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 4 of 6 | next ›
Discussion Overview
groupusers @
categoriescamel
postedNov 20, '14 at 5:21a
activeOct 20, '15 at 3:15a
posts6
users2
websitecamel.apache.org

2 users in discussion

Camel Guy: 4 posts Willem Jiang: 2 posts

People

Translate

site design / logo © 2021 Grokbase