2009/2/26 Claus Ibsen <claus.ib...@gmail.com>:
> On Wed, Feb 25, 2009 at 7:29 PM, James Strachan
> <james.strac...@gmail.com> wrote:
>> Here's a test case to show the kind of thing we can now do...
>> http://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/StartAndStopRoutesTest.java
>>
>> there's now a start/stop route method on CamelContext where you can
>> start or stop individual routes using the route definition (which lets
>> you also mutate routes). Routes with the same ID replace old ones,
>> otherwise its a new route. So you could get a route definition, clear
>> the ID and start it to clone a route.
>>
>> So far it looks like most of the tests still pass. Do folks think the
>> API seems OK to them? I've tried to hide as much of the internal
>> details as possible - so the API is primarily dealing with the route
>> definitions (RouteType classes)
>
> Looks great. We can always ponder with the API later.
> Maybe from a maintenance point of view you would like to be able to
> stop routes based on the id alone,
> so you from a web console can stop / start routes and submit the id
> from the web form.

>From the web console we can hide all that easily and make a simple to
use UI. (I should have something working today). Already the REST API
uses route IDs in URIs to navigate routes

/routes is all the routes
/routes/{id} looks at a single route by ID from there we can have
start/stop actions etc

>From a RouteType you can get its "id" property via routeType.getId() -
which the runtime lazily creates on demand if the route definition
didn't create one (via idOrCreate()).


> I assume each route has a unique id that can be used
> for higher level manipulation from scripts (yeah there is a id on the
> route type and route service as well)?

Yes - I'm using the id property on the RouteType to uniquely identify
a route definition (RouteType) - and its RouteService. Its this ID
which associates the two things together - letting you change them
both independently. (e.g. update the RouteType while the RouteService
keeps running until you stop and start it when you are ready.
Currently btw calling start(RouteType) will implicity stop any
previously executing route of the same ID.

As an aside I wonder if one of these days we should refactor
org.apache.camel.model.*Type to be *Definition as thats kinda what
they are - the logical, design type definition of routes. For example
the SplitterDefintion just defines how to create a  Splitter, its not
a Splitter (the Processor in the processor package).



> So you can eg. submit a route to be replace an existing route from a
> script and pass in the route id?

Exactly. So you can choose to edit (replace) or clone (zap the ID)


> And a feature I would love in the future was to be able to pause
> individual consumers.
> eg. pause a file consumer temporary to pile up files and you can
> tamper with the routes, or you were told
> to pause it since some back end system is not available. So you can
> say that if you could
> pause routes then that would be lovely as it can be used as well.
>
> However we do have support for routes with multiple inputs (eg
> multiple from -> same route) so if you pause
> the route you pause them all, but I guess that could make sense.

I'm thinking for now at least the simplest thing is gonna be to close
the route for a 'pause'. One day we might come up with some neat way
to pause subsriptions and the like - but with all components I'm aware
of, the only real way to pause is to stop the route (to stop the
consumers). I guess you could leave the producers active; but
typically they don't do very much anyway :)

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

Reply via email to