On 5/15/07, Jeff Gunther <[EMAIL PROTECTED]> wrote:
On May 15, 2007, at 2:20 AM, James Strachan wrote:

> On 5/15/07, James Strachan <[EMAIL PROTECTED]> wrote:
>> On 5/14/07, Jeff Gunther <[EMAIL PROTECTED]> wrote:
>> > I'm developing a component/endpoint that implements a FTP server.
>>
>> Great!
>>
>> > When the user uploads a file to the server, the endpoint will
>> deposit
>> > the file into a queue. Currently, the Endpoint implements the
>> Service
>> > interface. I've noticed that the "stop" method is not being called
>> > when the CamelContext is stopped.
>> >
>> > Is this a bug or am I missing something?
>>
>> It sounds like a bug. BTW I made a slight change over the weekend so
>> that endpoints don't automatically start the producer/consumer inside
>> the create[Producer|Consumer]() methods, but rather the caller does
>> that (as I was having issues of multiple starts sometimes).
>>
>> One complication is that an endpoint can be a singleton (in the
>> spring
>> singleton sense), so that its created and then closed by the
>> CamelContext when its closed - or if its not a singleton, its
>> currently up to the caller to close it when its completed.
>>
>> Maybe its a bit too easy to create non-singleton endpoints which then
>> don't get closed? We might wanna tighten up the lifecycle stuff a
>> little more maybe
>
> Maybe we should make sure that the CamelContext always closes all
> endpoints, irrespective of if they are singletons or not, just in
> case?

Sounds like a great idea! Are you envisioning a "stop()" and "start
()" method on Endpoints?

FWIW we've a Service interface which contains start() and stop().
Right now Producer, Consumer and CamelContext all extend this
interface; though currently Endpoint doesn't (as its typically just a
bunch of data) though an Endpoint can implement Service if it wishes

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

Reply via email to