You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Jeff Gunther <je...@intalgent.com> on 2007/05/14 22:26:47 UTC

[camel] Service Interface

I'm developing a component/endpoint that implements a FTP server.  
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?

Jeff Gunther




Re: [camel] Service Interface

Posted by Jeff Gunther <je...@intalgent.com>.


Jeff Gunther
Intalgent
100 10th Street NE, Suite 303
Charlottesville, VA 22902
T: (434) 977-5152 ext. 100
F: (866) 812-5291
jeff.gunther@intalgent.com


On May 15, 2007, at 12:11 PM, James Strachan wrote:

> On 5/15/07, Jeff Gunther <je...@intalgent.com> wrote:
>> On May 15, 2007, at 2:20 AM, James Strachan wrote:
>>
>> > On 5/15/07, James Strachan <ja...@gmail.com> wrote:
>> >> On 5/14/07, Jeff Gunther <je...@intalgent.com> 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. 

Re: [camel] Service Interface

Posted by James Strachan <ja...@gmail.com>.
On 5/15/07, Jeff Gunther <je...@intalgent.com> wrote:
> On May 15, 2007, at 2:20 AM, James Strachan wrote:
>
> > On 5/15/07, James Strachan <ja...@gmail.com> wrote:
> >> On 5/14/07, Jeff Gunther <je...@intalgent.com> 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/

Re: [camel] Service Interface

Posted by Jeff Gunther <je...@intalgent.com>.
On May 15, 2007, at 2:20 AM, James Strachan wrote:

> On 5/15/07, James Strachan <ja...@gmail.com> wrote:
>> On 5/14/07, Jeff Gunther <je...@intalgent.com> 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?

Re: [camel] Service Interface

Posted by Rob Davies <ra...@gmail.com>.
On 15 May 2007, at 07:20, James Strachan wrote:

> On 5/15/07, James Strachan <ja...@gmail.com> wrote:
>> On 5/14/07, Jeff Gunther <je...@intalgent.com> 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?
+1

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


Re: [camel] Service Interface

Posted by James Strachan <ja...@gmail.com>.
On 5/15/07, James Strachan <ja...@gmail.com> wrote:
> On 5/14/07, Jeff Gunther <je...@intalgent.com> 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?
-- 
James
-------
http://macstrac.blogspot.com/

Re: [camel] Service Interface

Posted by James Strachan <ja...@gmail.com>.
On 5/14/07, Jeff Gunther <je...@intalgent.com> 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

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