Jeff Gunther
Intalgent
100 10th Street NE, Suite 303
Charlottesville, VA 22902
T: (434) 977-5152 ext. 100
F: (866) 812-5291
[EMAIL PROTECTED]
On May 15, 2007, at 12:11 PM, James Strachan wrote:
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
Understood, I'm doing that now. However, the stop method on the
Endpoint is never called when the CamelContext is stopped.