camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Camel context autostartup
Date Fri, 02 Nov 2012 11:11:33 GMT
On Tue, Oct 30, 2012 at 5:44 PM, Benjamin Graf <benjamin.graf@gmx.net> wrote:
> That is exactly the way I have already tried. But the spring-dm extender thread was a
different one than the one the camel context was later starting from. NO_START is a ThreadLocal
variable. :-(
>
> I hope there is way to get this invoked before start but in between the same thread.
>

I am not sure about why using ThreadLocal. I think it was for some
unit test optimizations.
Feel free to provide a patch that may not require a thread local, for
this kind of workaround.

Though in the future we would have a better solution with an easy use
configuration as logged in that JIRA.


> Benjamin
>
>
>
> Claus Ibsen <claus.ibsen@gmail.com> schrieb:
>
>>On Tue, Oct 30, 2012 at 3:38 PM, Benjamin Graf <Benjamin.Graf@gmx.net>
>>wrote:
>>> Hi Claus,
>>>
>>> Thanks so far. But did you find a workaround for setting the NO_START
>>flag?
>>>
>>
>>Maybe you can set it using a <bean> in Spring? Its a static method.
>>Somehow configure in Spring XML to invoke this NO_START method and set
>>its value to false.
>>
>>
>>
>>
>>
>>> Regards,
>>> Benjamin
>>>
>>> -------- Original-Nachricht --------
>>>> Datum: Tue, 30 Oct 2012 15:23:49 +0100
>>>> Von: Claus Ibsen <claus.ibsen@gmail.com>
>>>> An: users@camel.apache.org
>>>> Betreff: Re: Camel context autostartup
>>>
>>>> Hi
>>>>
>>>> The documentation for autoStartup did indicate the current behavior
>>>>
>>http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/RuntimeConfiguration.html#setAutoStartup(java.lang.Boolean)
>>>>
>>>> I have logged a ticket
>>>> https://issues.apache.org/jira/browse/CAMEL-5759
>>>>
>>>>
>>>> On Mon, Oct 29, 2012 at 2:37 PM, Benjamin Graf
>><Benjamin.Graf@gmx.net>
>>>> wrote:
>>>> >
>>>> > -------- Original-Nachricht --------
>>>> >> Datum: Mon, 29 Oct 2012 13:20:09 +0100
>>>> >> Von: Claus Ibsen <claus.ibsen@gmail.com>
>>>> >> An: users@camel.apache.org
>>>> >> Betreff: Re: Camel context autostartup
>>>> >
>>>> >> On Mon, Oct 29, 2012 at 1:09 PM, Benjamin Graf
>><Benjamin.Graf@gmx.net>
>>>> >> wrote:
>>>> >> > The "poor" OSGi runtime is JBoss OSGi which is still a
>>technology
>>>> >> preview but is a feature of JBoss AS7.
>>>> >> >
>>>> >> > I know Karaf but it is no alternative for me. Might change
>>sometime
>>>> if
>>>> >> karaf has been integrated into JBoss.
>>>> >> >
>>>> >> > May be the Fuse (RedHat) guys out there can tell something
>>about
>>>> that!
>>>> >> ;-)
>>>> >>
>>>> >> I could tell you, but then I would have to kill you :) Okay just
>>>> >> kidding of course.
>>>> >
>>>> > :-)
>>>> >
>>>> >>
>>>> >> I know the autoStartup name is a poor name on the <camelContext>
>>but
>>>> >> it was as said inheirted from the routes.
>>>> >> Are you using spring-dm or OSGi Blueprint? I think in the latter
>>we
>>>> >> have a sort of a "hack" to disable starting CamelContext, which
>>is
>>>> >> used for some special tests. There is a static method on
>>>> >> SpringCamelContext which can be set to true to not start.
>>>> >
>>>> > Yes I'm using spring-dm and tried to set NO_START to false, but I
>>always
>>>> got the wrong thread. Maybe you know a good way to solve that?
>>>> >
>>>> >>
>>>> >> As we need to preserve backwards compatibility I wonder if we
>>should
>>>> >> introduce a new option on CamelContext to instruct it to skip
>>>> >> starting. But if so, what should it do?
>>>> >>
>>>> >> How would you start it? As it would possible need some logic to
>>at
>>>> >> least bootstrap a piece so it can either
>>>> >> - enlist a CamelContextMBean in JMX so you can start it from JMX.
>>>> >> - register a CamelContext in OSGi service registry so you can
>>start it
>>>> >> from OSGi
>>>> >> - or as now, but just have its state listed as started=false,
>>>> >> stopped=true. But do all its boostrap logic to enlist routes im
>>JMX,
>>>> >> osgi stuff and whatnot.
>>>> >
>>>> > Well, I would prefer something like:
>>>> > - enlist a CamelContextMBean in JMX so you can start/stop it from
>>JMX.
>>>> > Yes I know in OSGi it is quite another managed lifecycle, but so
>>you can
>>>> autostart stuff around the camel context to be preinitialized.
>>>> > - state listed as started=false (just do not invoke the stuff
>>start() or
>>>> as less as possible)
>>>> >
>>>> >>
>>>> >>
>>>> >>
>>>> >>
>>>> >> >
>>>> >> > -------- Original-Nachricht --------
>>>> >> >> Datum: Mon, 29 Oct 2012 12:21:24 +0100
>>>> >> >> Von: Claus Ibsen <claus.ibsen@gmail.com>
>>>> >> >> An: users@camel.apache.org
>>>> >> >> Betreff: Re: Camel context autostartup
>>>> >> >
>>>> >> >> On Mon, Oct 29, 2012 at 11:36 AM, Benjamin Graf
>>>> <Benjamin.Graf@gmx.net>
>>>> >> >> wrote:
>>>> >> >> >
>>>> >> >> > -------- Original-Nachricht --------
>>>> >> >> >> Datum: Mon, 29 Oct 2012 10:30:36 +0100
>>>> >> >> >> Von: Claus Ibsen <claus.ibsen@gmail.com>
>>>> >> >> >> An: users@camel.apache.org
>>>> >> >> >> Betreff: Re: Camel context autostartup
>>>> >> >> >
>>>> >> >> >> On Mon, Oct 29, 2012 at 10:25 AM, Benjamin Graf
>>>> >> <Benjamin.Graf@gmx.net>
>>>> >> >> >> wrote:
>>>> >> >> >> > Hi Claus,
>>>> >> >> >> >
>>>> >> >> >> > thanks so far. But does any method exists
to avoid auto
>>>> starting
>>>> >> >> context
>>>> >> >> >> using Spring OSGi with bundles activated?
>>>> >> >> >> >
>>>> >> >> >>
>>>> >> >> >> No, but you can if possible just dont start the
bundle
>>itself.
>>>> And
>>>> >> >> >> then start the bundle to start Camel.
>>>> >> >> >
>>>> >> >> > Well, that's a problem. My OSGi runtime does not support
>>this
>>>> feature
>>>> >> >> yet. :-( I was hoping camel autostartup is a good workaround.
>>>> >> >> >
>>>> >> >>
>>>> >> >> This must be a poor OSGi runtime, which can't manage lifecycle
>>of
>>>> the
>>>> >> >> bundles.
>>>> >> >> What do you use?
>>>> >> >>
>>>> >> >> And I am sure you are aware of Apache Karaf which is a
great
>>OSGi
>>>> >> runtime.
>>>> >> >> http://karaf.apache.org/
>>>> >> >>
>>>> >> >>
>>>> >> >> >>
>>>> >> >> >> The problem is that there is a chicken-egg situation.
>>>> CamelContext
>>>> >> >> >> need to be started so people can start it, using
eg JMX
>>etc.
>>>> >> >> >> And for that the context needs to be started to
enlist in
>>JMX
>>>> etc.
>>>> >> >> >
>>>> >> >> > That's why I actually have written my own JMX Service
for
>>>> >> >> starting/stopping context via JMX which is not dependant
if
>>context
>>>> has
>>>> >> been started yet.
>>>> >> >> >
>>>> >> >> > Maybe worth changing that behaviour at all?
>>>> >> >> >
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >> > Benjamin
>>>> >> >> >> >
>>>> >> >> >> > -------- Original-Nachricht --------
>>>> >> >> >> >> Datum: Mon, 29 Oct 2012 09:33:49 +0100
>>>> >> >> >> >> Von: Claus Ibsen <claus.ibsen@gmail.com>
>>>> >> >> >> >> An: users@camel.apache.org
>>>> >> >> >> >> Betreff: Re: Camel context autostartup
>>>> >> >> >> >
>>>> >> >> >> >> The autostartup options is for controlling
if *routes*
>>should
>>>> be
>>>> >> >> auto
>>>> >> >> >> >> started or not.
>>>> >> >> >> >> Not the actual CamelContext itself.
>>>> >> >> >> >>
>>>> >> >> >> >> The naming could have been better, but
the option was
>>first on
>>>> >> >> <route>
>>>> >> >> >> >> and then later inherited on <camelContext>
to make a
>>single
>>>> >> switch.
>>>> >> >> >> >>
>>>> >> >> >> >>
>>>> >> >> >> >> On Sat, Oct 27, 2012 at 4:57 PM, Benjamin
Graf
>>>> >> >> <benjamin.graf@gmx.net>
>>>> >> >> >> >> wrote:
>>>> >> >> >> >> > Hi,
>>>> >> >> >> >> >
>>>> >> >> >> >> > can anybody explain me why camel
context state is set
>>to
>>>> >> started
>>>> >> >> if
>>>> >> >> >> >> autostartup
>>>> >> >> >> >> > is set to false? This sound a bit
odd to me.
>>>> >> >> >> >> >
>>>> >> >> >> >> > Best,
>>>> >> >> >> >> > Benjamin
>>>> >> >> >> >> >
>>>> >> >> >> >>
>>>> >> >> >> >>
>>>> >> >> >> >>
>>>> >> >> >> >> --
>>>> >> >> >> >> Claus Ibsen
>>>> >> >> >> >> -----------------
>>>> >> >> >> >> Red Hat, Inc.
>>>> >> >> >> >> FuseSource is now part of Red Hat
>>>> >> >> >> >> Email: cibsen@redhat.com
>>>> >> >> >> >> Web: http://fusesource.com
>>>> >> >> >> >> Twitter: davsclaus
>>>> >> >> >> >> Blog: http://davsclaus.com
>>>> >> >> >> >> Author of Camel in Action: http://www.manning.com/ibsen
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >> --
>>>> >> >> >> Claus Ibsen
>>>> >> >> >> -----------------
>>>> >> >> >> Red Hat, Inc.
>>>> >> >> >> FuseSource is now part of Red Hat
>>>> >> >> >> Email: cibsen@redhat.com
>>>> >> >> >> Web: http://fusesource.com
>>>> >> >> >> Twitter: davsclaus
>>>> >> >> >> Blog: http://davsclaus.com
>>>> >> >> >> Author of Camel in Action: http://www.manning.com/ibsen
>>>> >> >>
>>>> >> >>
>>>> >> >>
>>>> >> >> --
>>>> >> >> Claus Ibsen
>>>> >> >> -----------------
>>>> >> >> Red Hat, Inc.
>>>> >> >> FuseSource is now part of Red Hat
>>>> >> >> Email: cibsen@redhat.com
>>>> >> >> Web: http://fusesource.com
>>>> >> >> Twitter: davsclaus
>>>> >> >> Blog: http://davsclaus.com
>>>> >> >> Author of Camel in Action: http://www.manning.com/ibsen
>>>> >>
>>>> >>
>>>> >>
>>>> >> --
>>>> >> Claus Ibsen
>>>> >> -----------------
>>>> >> Red Hat, Inc.
>>>> >> FuseSource is now part of Red Hat
>>>> >> Email: cibsen@redhat.com
>>>> >> Web: http://fusesource.com
>>>> >> Twitter: davsclaus
>>>> >> Blog: http://davsclaus.com
>>>> >> Author of Camel in Action: http://www.manning.com/ibsen
>>>>
>>>>
>>>>
>>>> --
>>>> Claus Ibsen
>>>> -----------------
>>>> Red Hat, Inc.
>>>> FuseSource is now part of Red Hat
>>>> Email: cibsen@redhat.com
>>>> Web: http://fusesource.com
>>>> Twitter: davsclaus
>>>> Blog: http://davsclaus.com
>>>> Author of Camel in Action: http://www.manning.com/ibsen
>>
>>
>>
>>--
>>Claus Ibsen
>>-----------------
>>Red Hat, Inc.
>>FuseSource is now part of Red Hat
>>Email: cibsen@redhat.com
>>Web: http://fusesource.com
>>Twitter: davsclaus
>>Blog: http://davsclaus.com
>>Author of Camel in Action: http://www.manning.com/ibsen
>
> --
> Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message