camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Camel Guy <ca...@devguy.com>
Subject Re: Register a new datasource from a route
Date Thu, 05 Feb 2015 15:46:10 GMT
I see this is fixed in 15.0. I can use the snapshot but how do I use this
feature?

By the way, this is my solution for IMO a shortcoming in Camel (after using
it for a year) - the inability to pass objects to consumers except via
essentially static beans or something like ehcache. I'm using addRoute at
runtime with dynamically generated from Uris. If you need to pass something
more complex than a sting to a consumer, and it changes at runtime, times
are hard.

Thanks,

cg


On Thursday, November 20, 2014, Willem Jiang <willem.jiang@gmail.com> wrote:

> 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
> <javascript:;>) 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
> <javascript:;>) 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
> > >>
> > >
> >
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message