camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: How to control when Spring initializes the XML Camel routes?
Date Fri, 27 Jun 2014 01:31:00 GMT
I just checked the code of CamelContextFactoryBean it just setup the camel route in the method
of onApplicationEvent. From the comments, camel just want to make sure all the inject works
are done before staring the camel context. 

My question is why you do you want to start the camel route before the whole application context
is ready? If it is reasonable, please feel free to fill a JIRA for it.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On June 27, 2014 at 5:08:36 AM, Jeff Bischoff (jbischoff@wdtablesystems.com) wrote:
> Okay, tried the work-around we discussed and it *almost* worked...
>  
> jvm 1 | 17:05:10,877 INFO [/wdts.table][SpringCamelContext]
> (pool-6-thread-1) Apache Camel 2.13.1 (CamelContext: myCamel) is starting
> jvm 1 | 17:05:10,879 INFO [/wdts.table][ManagedManagementStrategy]
> (pool-6-thread-1) JMX is enabled
> jvm 1 | 17:05:11,056 INFO [/wdts.table][DefaultTypeConverter]
> (pool-6-thread-1) Loaded 182 type converters
> jvm 1 | 17:05:11,104 INFO [/wdts.table][SpringCamelContext]
> (pool-6-thread-1) AllowUseOriginalMessage is enabled. If access to the
> original message is not needed, then its recommended to turn this option
> off as it may improve performance.
> jvm 1 | 17:05:11,104 INFO [/wdts.table][SpringCamelContext]
> (pool-6-thread-1) StreamCaching is not in use. If using streams then its
> recommended to enable stream caching. See more details at
> http://camel.apache.org/stream-caching.html
> jvm 1 | 17:05:11,104 INFO [/wdts.table][SpringCamelContext]
> (pool-6-thread-1) Total 0 routes, of which 0 is started.
> jvm 1 | 17:05:11,105 INFO [/wdts.table][SpringCamelContext]
> (pool-6-thread-1) Apache Camel 2.13.1 (CamelContext: myCamel) started in
> 0.229 seconds
>  
>  
>  
> Was able to start the context with the desired timing, but it came up with
> zero routes.
>  
> Doh!
>  
> Any further ideas on the workaround, or will I need that eagerStart
> feature?
>  
>  
> Thank you,
>  
>  
> Jeff
>  
> On 6/26/14 3:58 PM, "Claus Ibsen" wrote:
>  
> >On Thu, Jun 26, 2014 at 9:55 PM, Jeff Bischoff
> > wrote:
> >> Thanks so much for clarifying that; now I understand why the startup is
> >> happening when it does.
> >>
> >> Out of curiosity, what would happen if I called the start() method on
> >>the
> >> CamelContext bean from one of my beans? Would that muck things up?
> >>
> >
> >Yeah if you IoC CamelContext to your bean, and call its start() method
> >then it ought to start Camel at that point in time, instead of waiting
> >for spring to emit the context refreshed event at the end.
> >
> >> I'd be happy to log a ticket for startEager.
> >>
> >> Thanks,
> >>
> >> Jeff
> >>
> >> On 6/26/14 3:09 PM, "Claus Ibsen" wrote:
> >>
> >>>Hi
> >>>
> >>>I dont think you can do that, as we listen on ContextRefreshedEvent
> >>>from spring before we start Camel.
> >>>
> >>>We introduce a shutdownEager in CAMEL-7156 for camel-spring. We could
> >>>consider a startEager option as well, so we start CamelContext sooner.
> >>>
> >>>Feel free to log a JIRA ticket
> >>>http://camel.apache.org/support
> >>>
> >>>
> >>>
> >>>On Thu, Jun 26, 2014 at 8:59 PM, Jeff Bischoff
> >>> wrote:
> >>>> When I try this, I see the "myCamel" bean instantiated (it has been
> >>>>passed
> >>>> as a parameter to another bean) but it is not started at the time
> >>>>"foo"
> >>>>is
> >>>> instantiated. If I use a breakpoint at this spot and take a look in
> >>>> jconsole, I see that the Camel MBeans have not been registered yet.
> >>>>
> >>>> Later in the log (long after "foo" is initialized), I see the
> >>>>following
> >>>>in
> >>>> the log:
> >>>>
> >>>> jvm 1 | 14:37:10,017 INFO [/wdts.table][SpringCamelContext]
> >>>> (pool-6-thread-1) Apache Camel 2.13.1 (CamelContext: myCamel) is
> >>>>starting
> >>>>
> >>>> This seems to be the key line in the logs that shows things are really
> >>>> starting...
> >>>>
> >>>> How do I trigger that earlier?
> >>>>
> >>>> Thank you,
> >>>>
> >>>> Jeff
> >>>>
> >>>> On 6/26/14 10:59 AM, "Claus Ibsen" wrote:
> >>>>
> >>>>>You set the others beans to have depends-on Camel.
> >>>>>
> >>>>>> >>>>>
> >>>>> ...
> >>>>>
> >>>>>> >>>>>
> >>>>>
> >>>>>On Thu, Jun 26, 2014 at 4:52 PM, Jeff Bischoff
> >>>>> wrote:
> >>>>>> I'm having a problem using the Camel Spring DSL. Starting the
routes
> >>>>>>seems to be the very last thing that is done during Spring
> >>>>>>initialization.
> >>>>>>
> >>>>>> How do I trigger Spring to fully initialize camel and all the
camel
> >>>>>>routes earlier in the Spring initialization process (i.e. before
a
> >>>>>>particular other bean is initialized)?
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> Thanks,
> >>>>>>
> >>>>>> Jeff
> >>>>>> ________________________________
> >>>>>>
> >>>>>> Please take note: This email, including attachments, contains
> >>>>>>information which may be confidential or legally privileged and
is
> >>>>>>only
> >>>>>>for the use of the individual or entity to whom it is properly
> >>>>>>addressed. Any unauthorized review, use, disclosure, copying,
or
> >>>>>>distribution is prohibited. If you have reason to believe that
you
> >>>>>>have
> >>>>>>received this communication in error, or that it may be misaddressed
> >>>>>>or
> >>>>>>not intended for you, please destroy it and notify the sender
> >>>>>>immediately. Thank you.
> >>>>>
> >>>>>
> >>>>>
> >>>>>--
> >>>>>Claus Ibsen
> >>>>>-----------------
> >>>>>Red Hat, Inc.
> >>>>>Email: cibsen@redhat.com
> >>>>>Twitter: davsclaus
> >>>>>Blog: http://davsclaus.com
> >>>>>Author of Camel in Action: http://www.manning.com/ibsen
> >>>>>hawtio: http://hawt.io/
> >>>>>fabric8: http://fabric8.io/
> >>>>
> >>>> ________________________________
> >>>>
> >>>> Please take note: This email, including attachments, contains
> >>>>information which may be confidential or legally privileged and is only
> >>>>for the use of the individual or entity to whom it is properly
> >>>>addressed. Any unauthorized review, use, disclosure, copying, or
> >>>>distribution is prohibited. If you have reason to believe that you have
> >>>>received this communication in error, or that it may be misaddressed
or
> >>>>not intended for you, please destroy it and notify the sender
> >>>>immediately. Thank you.
> >>>
> >>>
> >>>
> >>>--
> >>>Claus Ibsen
> >>>-----------------
> >>>Red Hat, Inc.
> >>>Email: cibsen@redhat.com
> >>>Twitter: davsclaus
> >>>Blog: http://davsclaus.com
> >>>Author of Camel in Action: http://www.manning.com/ibsen
> >>>hawtio: http://hawt.io/
> >>>fabric8: http://fabric8.io/
> >>
> >> ________________________________
> >>
> >> Please take note: This email, including attachments, contains
> >>information which may be confidential or legally privileged and is only
> >>for the use of the individual or entity to whom it is properly
> >>addressed. Any unauthorized review, use, disclosure, copying, or
> >>distribution is prohibited. If you have reason to believe that you have
> >>received this communication in error, or that it may be misaddressed or
> >>not intended for you, please destroy it and notify the sender
> >>immediately. Thank you.
> >
> >
> >
> >--
> >Claus Ibsen
> >-----------------
> >Red Hat, Inc.
> >Email: cibsen@redhat.com
> >Twitter: davsclaus
> >Blog: http://davsclaus.com
> >Author of Camel in Action: http://www.manning.com/ibsen
> >hawtio: http://hawt.io/
> >fabric8: http://fabric8.io/
>  
> ________________________________
>  
> Please take note: This email, including attachments, contains information which may 

> be confidential or legally privileged and is only for the use of the individual or entity
 
> to whom it is properly addressed. Any unauthorized review, use, disclosure, copying,
 
> or distribution is prohibited. If you have reason to believe that you have received this
 
> communication in error, or that it may be misaddressed or not intended for you, please
 
> destroy it and notify the sender immediately. Thank you.
>  


Mime
View raw message