On Tue, Aug 3, 2010 at 10:30 PM, Christian Schneider
<[email protected]> wrote:
>
>
> Am 03.08.2010 06:04, schrieb Claus Ibsen:
>>
>> Yes you need to differentiate between resume/start in your business logic.
>> The consumer most often need to different logic. For example a HTTP
>> consumer may have to setup and start a HTTP server.
>> Where as in resume it just need to accept requests instead of sending
>> back http status 503 (temporary out of service).
>>
>> Keep the states/methods separated makes it easier to implement and
>> understand.
>>
>> If you extend ServiceSupport then you got these callbacks you can
>> override:
>> - doStart
>> - doStop
>> - doResume
>> - doSuspend
>> - doShutdown (special when CamelContext is shutting down)
>>
> That is a good idea to keep these methods simple.
>>
>> But the logic in the startRoute, resumeRoute has built in so they
>> handle if you invoke either one.
>> So if a route is suspended and your invoke startRoute then it knows
>> that it should resume the route. And vice versa. So from a management
>> point of view in JMX it should not be confusing.
>>
> This also sounds good. The only problem is then that users will probably
> understand the diagram in the documentation
> as how the management methods work. So it could be confusing that e.g.
> startRoute also works from suspended state.
> But as I guess that all the transitions in the diagram work as explained the
> diagram does not explain anything wrong.
>>

I will add a note in the diagram that JMX operations can figure out to
invoke either resume/start depending on the state.


>> stop ->  suspend is a bit harder, due you would need to start it and
>> then suspend it immediately, but there is a "window" where the route
>> is actually started, and it could potentially take in messages. And
>> routes can most often start very fast. Well there may be some WS
>> components who parse WSDL files etc which may take some time. We could
>> introduce a doWarmUp callback which is invoked when CamelContext is
>> starting up. It would then allow to pre parse the WSDL files etc. so
>> the consumer is "almost ready".
>>
> I do not think this is really necessary. I only proposed the transition for
> completenes. A warmup method makes the interface more complex and offers
> not so much value as camel is already starting quite fast.
>
> Btw. I also think shutdown could be renamed to remove. Without any more
> knowledge I would interpret shutdown as something that can be reversed by
> start. So remove is much clearer.
>

The JDK API uses shutdown for its thread pools, which means you can
actually not stat them again.
I think it may be the same for other 3rd party APIs such as quartz.

But remove is more meaningful as the service/route must be stopped
before you shutdown.
I have added removeRoute and marked shutdownRoute as @deprecated.


> Greetings
>
> Christian
>>
>>
>>
>
> --
> ----
> http://www.liquid-reality.de
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to