How to update camel properties externally?

2020-05-06 14:01发布

Im developping non OSGI app and i need to update the values ​​of some properties used in camel routes (loaded BridgePropertyPlaceHolder). So I thought:

  • To use Hawtio, the cool mangement console, in order update camel using JMX

  • Create a JMX MBean that will update the properties ..

I successfully create the MBean operations and call them using JMX, but I can't figure out how to update the camel routes that depends on these properties.

Is there a way to update the camel context externally?

Update: Exemple of use case:when a remote server doesn't return response, we keep sending messages until we reach the max of unsuccessful attempt(messages without ack). in camel we create a router pattern based on property loaded from file system. This property can change occasionally, and we want to do this without restarting server, but the problem is that camel parse routes when starting context and i can't find no mean to update routes accordingly.


I am grateful for any proposal that could help:)

3条回答
We Are One
2楼-- · 2020-05-06 14:45

For what properties you want them to be dynamic.you can move those prop to some db and fetch them whenever you are reading.I think a redesign is required for your camel route.

查看更多
欢心
3楼-- · 2020-05-06 14:55

If you use Camel error handling to retry (redeliver) then you can use the retryWhile to keep retrying until you return false. This allows you to use java code etc, and that allows you to read the updated configuration option.

See more details at

And if you have a copy of Camel in Action book, see page 152

查看更多
虎瘦雄心在
4楼-- · 2020-05-06 15:04

Changing from endpoint parameters such as URLs etc., following procedure has to be used according to dynamic change endpoint camel:

  1. stop the route
  2. remove the route
  3. change the endpoint
  4. add the route
  5. start the route

If the to endpoint has to be configurable, you may use the recipient list component. Here you may read properties from a database and/or from the filesystem using the appropriate Camel component.

查看更多
登录 后发表回答