camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: How to change Camel endpoint at run time?
Date Fri, 20 Nov 2009 05:55:52 GMT
On Fri, Nov 20, 2009 at 5:18 AM, Anto Paul <> wrote:
> Hi,
>    As an example take an FTP poller that has to connect to a server when a
> particular event is triggered. We have to provide a UI to the end user who
> can change the FTP server address at anytime. He can add more servers or
> remove server or change an existing server. AFAIK Camel 2.0 cannot delete a
> route once it is defined. What I learned from mail archives is that Camel
> context has to be stopped to destroy a route. I also read in the 2.1 release
> notes that the ability to add/stop route feature is added.
>    BTW with 2.0, I tried to remove an endpoint like this and it is still
> sending messages to that endpoint.
>          context.removeEndpoints("vm://a")

You have to stop the route


And use the new .routeId("myRoute") to assign an id to the route.
Otherwise they get auto generate route ids.

You could also stop the FtpConsumer on that route, change its
configuration and start it again. However then you need to dig a bit
deeper in the Camel API
That way you can reuse the same route if that is needed.

That is something on the line as

context.getRoutes() .. dribble through the list and find your route
Route route ...

Consumer = route.getConsumer();
// cast to FTP consumer
// change values on the consumer

You can also use JMX to manage at runtime. For example:

However I do not think we expose fine grained configuration of the FTP
endpoint. However that is possible to add in the future.

> Anto
> On Thu, Nov 19, 2009 at 7:05 PM, Claus Ibsen <> wrote:
>> On Thu, Nov 19, 2009 at 6:27 AM, Anto Paul <>
>> wrote:
>> > Hi,
>> >   I need to add/remove endpoint URI at runtime when user
>> > adds/removes/updates the URI using a web application. I need to expose
>> > HTTP,FTP,web service and JMS endpoints as consumers and producers. On
>> > searching mail archive the solution I found is to stop camel context to
>> stop
>> > a route.
>> >
>> Hi
>> Can you tell a bit more what you mean by add/remove endpoint at runtime?
>> Can you give a little example?
>> You can use the Camel API to create routes at runtime.
>> And the same API to stop/start routes etc.
>> --
>> Claus Ibsen
>> Apache Camel Committer
>> Author of Camel in Action:
>> Open Source Integration:
>> Blog:
>> Twitter:

Claus Ibsen
Apache Camel Committer

Author of Camel in Action:
Open Source Integration:

View raw message