Re: How to prevent routes from started twice?

2009-06-18 Thread Claus Ibsen
On Thu, Jun 18, 2009 at 9:42 AM, akuhtz  wrote:

>
> Hi, I've tested it yesterday and it works fine. Thanks a lot for that.
> Maybe
> you can check my comments after your last commit to enable manual start if
> the shouldStartContext flag is set to false.


Can you create a small unit test to include in camel-spring as a unit test
that setup a camel context with the shouldStartContext=false

And with a simple route with a timer to a mock.
Then we know that the timer should not kick in if not supposted to start.

And then we can work on starting camel from eg another bean or how you do
that.
But having a simple unit test for starters always help.



>
> --
> View this message in context:
> http://www.nabble.com/How-to-prevent-routes-from-started-twice--tp23983653p24087986.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>


-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus


Re: How to prevent routes from started twice?

2009-06-18 Thread akuhtz

Hi, I've tested it yesterday and it works fine. Thanks a lot for that. Maybe
you can check my comments after your last commit to enable manual start if
the shouldStartContext flag is set to false.
-- 
View this message in context: 
http://www.nabble.com/How-to-prevent-routes-from-started-twice--tp23983653p24087986.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: How to prevent routes from started twice?

2009-06-18 Thread Claus Ibsen
Hi
I have committed a fix. Please try a SNAPSHOT and test if it works for you.


On Mon, Jun 15, 2009 at 1:20 PM, akuhtz  wrote:

>
> Hi Claus,
>
> I created the JIRA task
> https://issues.apache.org/activemq/browse/CAMEL-1711. Simple project and a
> logfile is attached.
> --
> View this message in context:
> http://www.nabble.com/How-to-prevent-routes-from-started-twice--tp23983653p24032807.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>


-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus


Re: How to prevent routes from started twice?

2009-06-15 Thread akuhtz

Hi Claus,

I created the JIRA task
https://issues.apache.org/activemq/browse/CAMEL-1711. Simple project and a
logfile is attached.
-- 
View this message in context: 
http://www.nabble.com/How-to-prevent-routes-from-started-twice--tp23983653p24032807.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: How to prevent routes from started twice?

2009-06-12 Thread Claus Ibsen
On Fri, Jun 12, 2009 at 2:08 PM, akuhtz wrote:
>
> I see it twice! Once for the root application context (which is correct,
> because its the context where the camel context is defined in) and a second
> time for the web application context (which I think is incorrect because
> it's the child context of the root).
>
> I don't know if it would work in all cases if the applicationContext
> instance of the refresh event would be evaulated and only refresh events for
> the applicationContext of the camel context is processed ...
Hi

Make sure to attach a .zip with a sample project of yours as its
something unusual and this is the first time its reported.

Are the logs line being logged rapidly right after each other?
And do you in fact have 2 x  in spring XML files or only 1 tag?


> --
> View this message in context: 
> http://www.nabble.com/How-to-prevent-routes-from-started-twice--tp23983653p23997647.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus


Re: How to prevent routes from started twice?

2009-06-12 Thread akuhtz

I see it twice! Once for the root application context (which is correct,
because its the context where the camel context is defined in) and a second
time for the web application context (which I think is incorrect because
it's the child context of the root).

I don't know if it would work in all cases if the applicationContext
instance of the refresh event would be evaulated and only refresh events for
the applicationContext of the camel context is processed ... 
-- 
View this message in context: 
http://www.nabble.com/How-to-prevent-routes-from-started-twice--tp23983653p23997647.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: How to prevent routes from started twice?

2009-06-12 Thread Claus Ibsen
On Fri, Jun 12, 2009 at 1:30 PM, akuhtz wrote:
>
> Hi Claus,
>
> I does honor but the problem is that you can't start the camel context (from
> another bean) if shouldStartContext is set to false, and this is the only
> way to prevent the execution of code that is triggered by refresh event.
>
> I'll create a JIRA ticket with a problem description.
BTW how many times do you see this log line if you enable DEBUG
logging for org.apache.camel?
if (LOG.isDebugEnabled()) {
LOG.debug("Publishing spring-event: " + event);
}



>
> --
> View this message in context: 
> http://www.nabble.com/How-to-prevent-routes-from-started-twice--tp23983653p23997172.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus


Re: How to prevent routes from started twice?

2009-06-12 Thread akuhtz

Hi Claus,

I does honor but the problem is that you can't start the camel context (from
another bean) if shouldStartContext is set to false, and this is the only
way to prevent the execution of code that is triggered by refresh event.

I'll create a JIRA ticket with a problem description.

-- 
View this message in context: 
http://www.nabble.com/How-to-prevent-routes-from-started-twice--tp23983653p23997172.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: How to prevent routes from started twice?

2009-06-12 Thread Claus Ibsen
Hi

Could you create a JIRA ticket for this.
Camel should honor the shouldStartContext when it receives this spring
refresh event.



On Thu, Jun 11, 2009 at 5:33 PM, akuhtz wrote:
>
> Hi,
>
> I've a spring based web application that has 2 applicationContexts (the
> second has the first as parent). My problem is that the SpringCamelContext
> listens to the ContextRefreshedEvent and starts the camel context.
>
> This works fine if you have only 1 context but if the ContextRefreshedEvent
> of the second context is received the routes are started a second time.
> The second start of the camel context is catched correctly (in
> ServiceSupport) but I think the the startRoutes() in the start()-method of
> DefaultCamelContext should also prevent to be called twice...
>
> My config details: I start the camel context from another thread than that
> one that creates the ApplicationContext and already I played with the
> shouldStartContext set to false but this prevents the start the camel
> context at all.
> I know that my scenario with the different threads cause this problem but it
> should be possible to prevent the automatic start with the
> ContextRefreshedEvent but start the camel context manually.
>
> Andreas
> --
> View this message in context: 
> http://www.nabble.com/How-to-prevent-routes-from-started-twice--tp23983653p23983653.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus


How to prevent routes from started twice?

2009-06-11 Thread akuhtz

Hi,

I've a spring based web application that has 2 applicationContexts (the
second has the first as parent). My problem is that the SpringCamelContext
listens to the ContextRefreshedEvent and starts the camel context. 

This works fine if you have only 1 context but if the ContextRefreshedEvent
of the second context is received the routes are started a second time. 
The second start of the camel context is catched correctly (in
ServiceSupport) but I think the the startRoutes() in the start()-method of
DefaultCamelContext should also prevent to be called twice...

My config details: I start the camel context from another thread than that
one that creates the ApplicationContext and already I played with the
shouldStartContext set to false but this prevents the start the camel
context at all.
I know that my scenario with the different threads cause this problem but it
should be possible to prevent the automatic start with the
ContextRefreshedEvent but start the camel context manually.

Andreas
-- 
View this message in context: 
http://www.nabble.com/How-to-prevent-routes-from-started-twice--tp23983653p23983653.html
Sent from the Camel - Users mailing list archive at Nabble.com.