Callback after startup from org.apache.camel.main.Main afterStart()

2013-04-03 Thread Andrew Bailey
I have a use case, where I require a fast startup time for camel and wish to avoid classpath scanning. I use the Main class however it appears that its not possible to obtain a ProducerTemplate template = getCamelTemplate(); before calling the run method. (it produces an ArrayOutOfBounds exception

Re: Callback after startup from org.apache.camel.main.Main afterStart()

2013-04-05 Thread Claus Ibsen
Hi Yeah we could add some methods to the Main class you can override to have callbacks after start | before stop etc. But you can also just use the event notifier api in Camel for that. On Wed, Apr 3, 2013 at 4:17 PM, Andrew Bailey wrote: > I have a use case, where I require a fast startup tim

Re: Callback after startup from org.apache.camel.main.Main afterStart()

2013-04-08 Thread Andrew Bailey
Claus, thanks for the reply. Ok I tried that, however, if in the bootstrap code in main just before calling run() I place List contexts=getCamelContexts(); System.out.println(contexts); // [] CamelContext context=contexts.get(0); //IndexOutOfBoundsException: Index

Re: Callback after startup from org.apache.camel.main.Main afterStart()

2013-04-09 Thread Claus Ibsen
Hi Yeah we probably need some API on MainSupport so you can add a custom EventNotifier, which we then add to the CamelContext before its started. Though another option that may be easier is just to have a beforeStart | beforeStop method which you can implement and do your custom code there. A bit

Re: Callback after startup from org.apache.camel.main.Main afterStart()

2013-04-10 Thread Chris Wolf
What I did was extend Main, overriding: protected AbstractApplicationContext createDefaultApplicationContext(); The overridden method looks like: @Override public AbstractApplicationContext createDefaultApplicationContext() { AbstractApplicationContext appctx = super.createDefaultApplicationC

Re: Callback after startup from org.apache.camel.main.Main afterStart()

2013-04-13 Thread Claus Ibsen
Chris, Yeah this would work. But only when you use Spring. We should have a common and easier solution for the MainSupport in camel-core. I have logged a ticket https://issues.apache.org/jira/browse/CAMEL-6269 On Wed, Apr 10, 2013 at 4:24 PM, Chris Wolf wrote: > What I did was extend Main, over