camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bruno.bor...@gmail.com
Subject Re: RE: Multiple consumers getting created in custom endpoint
Date Wed, 08 Apr 2009 14:53:23 GMT
I think you should "kill" your threads on method doStop() or stop() of your  
consumer.

They are invoked when CamelContext is stopped.

Cheers,
Bruno Borges

On Apr 8, 2009 12:38am, Manish K Bafna <Manish.Bafna@headstrong.com> wrote:
> The same is visible in JMS component too.

> Steps:

> 1. Create a route from JMS topic1 to JMS queue1

> 2. Start the context

> 3. Send 1 message to the topic.

> 4. The queue will also receive 1 message.

> 5. Stop the context

> 6. Start the context again

> 7. Send 1 message to the topic.

> 8. the same message will be seen in the queue 2 times when there should  
> be only 1.

> 9. Repeat the above steps and the number increases.



> Thanks,

> Manish.



> -----Original Message-----

> From: Manish K Bafna

> Sent: Tuesday, April 07, 2009 6:45 PM

> To: camel-user@activemq. apache. org (camel-user@activemq.apache.org)

> Subject: Multiple consumers getting created in custom endpoint



> Hi,

> I am creating my own custom endpoint using Camel 1.5



> public class AbcEndpoint extends DefaultEndpoint {

> public Consumer createConsumer(Processor processor) throws Exception {

> Consumer c=new AbcConsumer(this,processor);

> return c;

> }

> .....

> }



> public class AbcConsumer extends DefaultConsumer

> {

> protected void doStart() throws Exception {..do something...}

> protected void doStop() throws Exception {--do something--}

> }



> When is start the context for the 1st time, 1 consumer is created, when I  
> stop it and start it again, createConsumer() is called 2 times and so on.

> Do I have to do something to avoid this behavior. The problem is in the  
> doStart() method of the Consumer, I am creating my own threads. Now since  
> createConsumer() is being 2 times, doStart() is being called 2 times and  
> multiple threads are being created.












Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message