You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ext2 <xu...@tongtech.com> on 2010/12/08 07:31:53 UTC

How about to support dynamic configurations in camel?

Hi:
	Changing the configuration dynamically at runtime to adjust the
behavior of application is a use-full feature for many application.
	Camel support some dynamic mechanism now, etc: dynamic-routing
pattern; but I still encounter some limits while using camel. For example:
1)how could I dynamic change the behavior of a user custom bean? 2)How could
I dynamic change the behavior of the from endpoint and camel's processor?
etc: a filter's  condition , changing the transaction's default time-out.
3)dynamic create  a  new endpoint is not always needed, when we doesn’t
really need dynamic routing , but just change a special behavior of endpoint
at runtime: ex. change a waiting timeout when calling a webservice;

	For these requirements, we(camel) could resolve them by custom
solution for each situation. But if camel support some common mechanism to
support this, things will be better;
	While we using osgi with Apache Karaf, a basic dynamic configuration
mechanism is already in-place; That is:  OSGI Configuration Admin Service
and configuration property file deploying (Apache Karaf support it to
mapping hot  deployed property files to osgi configurations).
	So I am wondering if camel support this , dynamic configuration will
be simplified; Maybe the usage will looks like as following:
	1) user could write a property file as configuration: key will be
mapped to Camel component(even endpoint)'s and user bean's property based on
a  simple rule。the value will be mapping to the property's value; 
	I am not sure about the rule about how to mapp the key to property.
So I using a simplified rule to illustrate my thought: property file's key =
bean-id + "." + property-name.(this rule has a limit that it cannot mapping
property to endpoint).
	2) While starting camel,  camel will register a listener service for
the osgi dynamic configuration. At runtime , while the listener received
dynamic changed configuration , it will mapping the value to camel
component, endpoint, or user custom bean's property.
	3) Endpoint, Bean(also Camel  Component) must implements a
dynamic-configurable interface to say "I can be configured dynamically".
	Actually, in my own application, I have extend such a feature based
on spring(it somewhat  like spring's property override ). But it's limited,
and can not configure endpoint dynamically; Also I must changed some source
code of camel component to support my requirement.
	As the dynamic configuration requirement is very important for my
application, I think it maybe useful for the others. So I post it here;

	Finally, dynamic-configuration requirement is not limited in OSGI.
In the other situation, people should extend their own
dynamic-configuration-detecting mechanism, and integrate it with camel;

Thanks for any suggestion;
Best Regards





Re: How about to support dynamic configurations in camel?

Posted by jmh <je...@nrb.be>.
Hi,

I agree with you about your dynamic configuration suggestion for Camel 

I'm also using Karaf (OSGi) and its hot-reloading property files feature

Regards
J-M
-- 
View this message in context: http://camel.465427.n5.nabble.com/idempotentConsumer-and-eager-option-tp3293765p3302085.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How about to support dynamic configurations in camel?

Posted by ext2 <xu...@tongtech.com>.
Hi, Willem Jiang:
	Yes, you are right. No all properties must support dynamic
configuration; The key-point of the requirement is not ask for all property
be dynamic configured, but the camel can support a dynamic-configure
extending mechanism  which support: the user could  using it to extending
their own dynamic configuration functions, and camel component,
endpoint(especially "from" endpoint) and processor will also rely on it to
support some dynamic configuration functions;

Thanks a lot

-----Origin -----
Sender: Willem Jiang [mailto:willem.jiang@gmail.com] 
Date: 2010/12/8 16:06
Receiver: users@camel.apache.org
Subject: Re: How about to support dynamic configurations in camel?

On 12/8/10 2:31 PM, ext2 wrote:
> Hi:
> 	Changing the configuration dynamically at runtime to adjust the
> behavior of application is a use-full feature for many application.
> 	Camel support some dynamic mechanism now, etc: dynamic-routing
> pattern; but I still encounter some limits while using camel. For example:
> 1)how could I dynamic change the behavior of a user custom bean? 2)How
could
> I dynamic change the behavior of the from endpoint and camel's processor?
> etc: a filter's  condition , changing the transaction's default time-out.
> 3)dynamic create  a  new endpoint is not always needed, when we doesn’t
> really need dynamic routing , but just change a special behavior of
endpoint
> at runtime: ex. change a waiting timeout when calling a webservice;

Now Camel components' consumer and producer  have some headers to
override the endpoint configuration dynamically.

We can add some kind of utils method to pick up the properties change
notification in consumer, producer or processor, in this way we don't
need to change the component API a lot.

But there are some properties can't be changed dynamically, such as the
FileConsumer polling directory etc. We need to stop the endpoint first,
change the value  and restart the endpoint.

> 
> 	For these requirements, we(camel) could resolve them by custom
> solution for each situation. But if camel support some common mechanism to
> support this, things will be better;
> 	While we using osgi with Apache Karaf, a basic dynamic configuration
> mechanism is already in-place; That is:  OSGI Configuration Admin Service
> and configuration property file deploying (Apache Karaf support it to
> mapping hot  deployed property files to osgi configurations).
> 	So I am wondering if camel support this , dynamic configuration will
> be simplified; Maybe the usage will looks like as following:
> 	1) user could write a property file as configuration: key will be
> mapped to Camel component(even endpoint)'s and user bean's property based
on
> a  simple rule。the value will be mapping to the property's value;
> 	I am not sure about the rule about how to mapp the key to property.
> So I using a simplified rule to illustrate my thought: property file's key
=
> bean-id + "." + property-name.(this rule has a limit that it cannot
mapping
> property to endpoint).
> 	2) While starting camel,  camel will register a listener service for
> the osgi dynamic configuration. At runtime , while the listener received
> dynamic changed configuration , it will mapping the value to camel
> component, endpoint, or user custom bean's property.
> 	3) Endpoint, Bean(also Camel  Component) must implements a
> dynamic-configurable interface to say "I can be configured dynamically".
> 	Actually, in my own application, I have extend such a feature based
> on spring(it somewhat  like spring's property override ). But it's
limited,
> and can not configure endpoint dynamically; Also I must changed some
source
> code of camel component to support my requirement.
> 	As the dynamic configuration requirement is very important for my
> application, I think it maybe useful for the others. So I post it here;
> 
> 	Finally, dynamic-configuration requirement is not limited in OSGI.
> In the other situation, people should extend their own
> dynamic-configuration-detecting mechanism, and integrate it with camel;
> 
> Thanks for any suggestion;
> Best Regards
> 
> 
> 
> 
> 


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang



Re: How about to support dynamic configurations in camel?

Posted by Willem Jiang <wi...@gmail.com>.
On 12/8/10 2:31 PM, ext2 wrote:
> Hi:
> 	Changing the configuration dynamically at runtime to adjust the
> behavior of application is a use-full feature for many application.
> 	Camel support some dynamic mechanism now, etc: dynamic-routing
> pattern; but I still encounter some limits while using camel. For example:
> 1)how could I dynamic change the behavior of a user custom bean? 2)How could
> I dynamic change the behavior of the from endpoint and camel's processor?
> etc: a filter's  condition , changing the transaction's default time-out.
> 3)dynamic create  a  new endpoint is not always needed, when we doesn’t
> really need dynamic routing , but just change a special behavior of endpoint
> at runtime: ex. change a waiting timeout when calling a webservice;

Now Camel components' consumer and producer  have some headers to
override the endpoint configuration dynamically.

We can add some kind of utils method to pick up the properties change
notification in consumer, producer or processor, in this way we don't
need to change the component API a lot.

But there are some properties can't be changed dynamically, such as the
FileConsumer polling directory etc. We need to stop the endpoint first,
change the value  and restart the endpoint.

> 
> 	For these requirements, we(camel) could resolve them by custom
> solution for each situation. But if camel support some common mechanism to
> support this, things will be better;
> 	While we using osgi with Apache Karaf, a basic dynamic configuration
> mechanism is already in-place; That is:  OSGI Configuration Admin Service
> and configuration property file deploying (Apache Karaf support it to
> mapping hot  deployed property files to osgi configurations).
> 	So I am wondering if camel support this , dynamic configuration will
> be simplified; Maybe the usage will looks like as following:
> 	1) user could write a property file as configuration: key will be
> mapped to Camel component(even endpoint)'s and user bean's property based on
> a  simple rule。the value will be mapping to the property's value;
> 	I am not sure about the rule about how to mapp the key to property.
> So I using a simplified rule to illustrate my thought: property file's key =
> bean-id + "." + property-name.(this rule has a limit that it cannot mapping
> property to endpoint).
> 	2) While starting camel,  camel will register a listener service for
> the osgi dynamic configuration. At runtime , while the listener received
> dynamic changed configuration , it will mapping the value to camel
> component, endpoint, or user custom bean's property.
> 	3) Endpoint, Bean(also Camel  Component) must implements a
> dynamic-configurable interface to say "I can be configured dynamically".
> 	Actually, in my own application, I have extend such a feature based
> on spring(it somewhat  like spring's property override ). But it's limited,
> and can not configure endpoint dynamically; Also I must changed some source
> code of camel component to support my requirement.
> 	As the dynamic configuration requirement is very important for my
> application, I think it maybe useful for the others. So I post it here;
> 
> 	Finally, dynamic-configuration requirement is not limited in OSGI.
> In the other situation, people should extend their own
> dynamic-configuration-detecting mechanism, and integrate it with camel;
> 
> Thanks for any suggestion;
> Best Regards
> 
> 
> 
> 
> 


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang