You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Jeff Bischoff <jb...@wdtablesystems.com> on 2014/06/26 16:52:33 UTC

How to control when Spring initializes the XML Camel routes?

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.

Re: How to control when Spring initializes the XML Camel routes?

Posted by Jeff Bischoff <jb...@wdtablesystems.com>.
So the key method that is not getting called when I manually do
context.start() is:

  org.apache.camel.core.xml.AbstractCamelContextFactoryBean.setupRoutes()


The comment:

  "Setup all the routes which must be done prior starting
org.apache.camel.CamelContext."


Okay, great I need that to happen first and when I manually call start()
it fails to start the routes because I haven't called setupRoutes() yet.
Now how does it get called normally? Looks like the answer to that is the
CamelContextFactoryBean:

            if (event instanceof ContextRefreshedEvent) {

            ...
                    // we need to defer setting up routes until Spring has
done all its dependency injection

                    // which is only guaranteed to be done when it emits
the ContextRefreshedEvent event.

                    setupRoutes();

                    LOG.trace("Starting the context now");

                    getContext().start();



Okay, so it looks like my workaround will work if I call this code instead
of directly calling context.start().

However, how do I get a handle on the Factory instance in Spring? Is there
a way to get it from the context itself?



Thank you,

Jeff

On 6/26/14 9:48 PM, "Jeff Bischoff" <jb...@wdtablesystems.com> wrote:

>The reason I want to start the route before the whole application context
>is ready is that some of the spring-loaded services in my application
>require a request/response message to be processed by another system in
>order to fully initialize. If the Camel routes haven't started yet, these
>messages won't be transmitted, meaning my services will wait indefinitely
>to finish initializing (and thus hold up spring initialization
>indefinitely, deadlocked). To work around this, I have kicked off a
>separate thread to wait for the Camel routes to be up and then finish
>initializing these paticular services. While this works, it defeats the
>Spring dependency mechanism, because now beans that depend on these
>services will think they are initialized when they are not.
>
>So, in short I think it is necessary to be able to control when Camel
>creates its routes in order to be in sync with the Spring dependency
>model. Ideally, the answer that Claus originally gave me would work.
>
>I will open a ticket when I have time (hopefully tomorrow).
>
>
>Best,
>
>Jeff
>
>Please note my email address has changed to: jbischoff@wdtablesystems.com
>
>________________________________________
>From: Willem Jiang <wi...@gmail.com>
>Sent: Thursday, June 26, 2014 9:31 PM
>To: users@camel.apache.org
>Subject: Re: How to control when Spring initializes the XML Camel routes?
>
>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.
>>
>
>________________________________
>
>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.

________________________________

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.

RE: How to control when Spring initializes the XML Camel routes?

Posted by Jeff Bischoff <jb...@wdtablesystems.com>.
The reason I want to start the route before the whole application context is ready is that some of the spring-loaded services in my application require a request/response message to be processed by another system in order to fully initialize. If the Camel routes haven't started yet, these messages won't be transmitted, meaning my services will wait indefinitely to finish initializing (and thus hold up spring initialization indefinitely, deadlocked). To work around this, I have kicked off a separate thread to wait for the Camel routes to be up and then finish initializing these paticular services. While this works, it defeats the Spring dependency mechanism, because now beans that depend on these services will think they are initialized when they are not.

So, in short I think it is necessary to be able to control when Camel creates its routes in order to be in sync with the Spring dependency model. Ideally, the answer that Claus originally gave me would work.

I will open a ticket when I have time (hopefully tomorrow).


Best,

Jeff

Please note my email address has changed to: jbischoff@wdtablesystems.com

________________________________________
From: Willem Jiang <wi...@gmail.com>
Sent: Thursday, June 26, 2014 9:31 PM
To: users@camel.apache.org
Subject: Re: How to control when Spring initializes the XML Camel routes?

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.
>

________________________________

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.

Re: How to control when Spring initializes the XML Camel routes?

Posted by Willem Jiang <wi...@gmail.com>.
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.
>  


Re: How to control when Spring initializes the XML Camel routes?

Posted by Jeff Bischoff <jb...@wdtablesystems.com>.
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" <cl...@gmail.com> wrote:

>On Thu, Jun 26, 2014 at 9:55 PM, Jeff Bischoff
><jb...@wdtablesystems.com> 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" <cl...@gmail.com> 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
>>><jb...@wdtablesystems.com> 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" <cl...@gmail.com> wrote:
>>>>
>>>>>You set the others beans to have depends-on Camel.
>>>>>
>>>>><bean id="foo" depends-on="myCamel"  ...
>>>>>
>>>>> ...
>>>>>
>>>>><camelContext id="myCamel" ...
>>>>>
>>>>>
>>>>>On Thu, Jun 26, 2014 at 4:52 PM, Jeff Bischoff
>>>>><jb...@wdtablesystems.com> 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.

Re: How to control when Spring initializes the XML Camel routes?

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Jun 26, 2014 at 9:55 PM, Jeff Bischoff
<jb...@wdtablesystems.com> 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" <cl...@gmail.com> 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
>><jb...@wdtablesystems.com> 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" <cl...@gmail.com> wrote:
>>>
>>>>You set the others beans to have depends-on Camel.
>>>>
>>>><bean id="foo" depends-on="myCamel"  ...
>>>>
>>>> ...
>>>>
>>>><camelContext id="myCamel" ...
>>>>
>>>>
>>>>On Thu, Jun 26, 2014 at 4:52 PM, Jeff Bischoff
>>>><jb...@wdtablesystems.com> 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/

Re: How to control when Spring initializes the XML Camel routes?

Posted by Jeff Bischoff <jb...@wdtablesystems.com>.
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?

I'd be happy to log a ticket for startEager.

Thanks,

Jeff

On 6/26/14 3:09 PM, "Claus Ibsen" <cl...@gmail.com> 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
><jb...@wdtablesystems.com> 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" <cl...@gmail.com> wrote:
>>
>>>You set the others beans to have depends-on Camel.
>>>
>>><bean id="foo" depends-on="myCamel"  ...
>>>
>>> ...
>>>
>>><camelContext id="myCamel" ...
>>>
>>>
>>>On Thu, Jun 26, 2014 at 4:52 PM, Jeff Bischoff
>>><jb...@wdtablesystems.com> 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.

Re: How to control when Spring initializes the XML Camel routes?

Posted by Claus Ibsen <cl...@gmail.com>.
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
<jb...@wdtablesystems.com> 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" <cl...@gmail.com> wrote:
>
>>You set the others beans to have depends-on Camel.
>>
>><bean id="foo" depends-on="myCamel"  ...
>>
>> ...
>>
>><camelContext id="myCamel" ...
>>
>>
>>On Thu, Jun 26, 2014 at 4:52 PM, Jeff Bischoff
>><jb...@wdtablesystems.com> 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/

Re: How to control when Spring initializes the XML Camel routes?

Posted by Jeff Bischoff <jb...@wdtablesystems.com>.
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" <cl...@gmail.com> wrote:

>You set the others beans to have depends-on Camel.
>
><bean id="foo" depends-on="myCamel"  ...
>
> ...
>
><camelContext id="myCamel" ...
>
>
>On Thu, Jun 26, 2014 at 4:52 PM, Jeff Bischoff
><jb...@wdtablesystems.com> 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.

Re: How to control when Spring initializes the XML Camel routes?

Posted by Claus Ibsen <cl...@gmail.com>.
You set the others beans to have depends-on Camel.

<bean id="foo" depends-on="myCamel"  ...

 ...

<camelContext id="myCamel" ...


On Thu, Jun 26, 2014 at 4:52 PM, Jeff Bischoff
<jb...@wdtablesystems.com> 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/