|
Hi,
is there any example or a helper class for running (starting/stopping) Camel in a web-app without using Spring xml? There is an example servlet app [1] and a tutorial [2] for running Camel in a web-app, but both are using Spring [1] http://camel.apache.org/servlet-tomcat-example.html [2] http://camel.apache.org/tutorial-on-using-camel-in-a-web-application.html Bilgin |
|
Hi
How would you bootstrap Camel in the web app? For example using a servlet or context listener? But then how would it know which routes / and whatnot to include? I guess either some new fancy CDI or you would have to refer to a config file / java class or whatnot? On Mon, Jun 25, 2012 at 4:41 PM, Bilgin Ibryam <[hidden email]> wrote: > Hi, > > is there any example or a helper class for running (starting/stopping) > Camel in a web-app without using Spring xml? > > There is an example servlet app [1] and a tutorial [2] for running Camel in > a web-app, but both are using Spring > > [1] http://camel.apache.org/servlet-tomcat-example.html > [2] > http://camel.apache.org/tutorial-on-using-camel-in-a-web-application.html > > > Bilgin -- Claus Ibsen ----------------- FuseSource Email: [hidden email] Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen |
|
Claus,
I was thinking to use ServletContextListener and create/start DefaultCamelContext when contextInitialized is called. The route I want to use is quite simple, so I can create it straightforward. Then stop camelContext when contextDestroyed is called. Similar to running camel as standalone app with Main class. Do you see any issues with this approach? Thanks Bilgin On 25 June 2012 16:55, Claus Ibsen <[hidden email]> wrote: > Hi > > How would you bootstrap Camel in the web app? > > For example using a servlet or context listener? > But then how would it know which routes / and whatnot to include? > > I guess either some new fancy CDI or you would have to refer to a > config file / java class or whatnot? > > > On Mon, Jun 25, 2012 at 4:41 PM, Bilgin Ibryam <[hidden email]> wrote: > > Hi, > > > > is there any example or a helper class for running (starting/stopping) > > Camel in a web-app without using Spring xml? > > > > There is an example servlet app [1] and a tutorial [2] for running Camel > in > > a web-app, but both are using Spring > > > > [1] http://camel.apache.org/servlet-tomcat-example.html > > [2] > > > http://camel.apache.org/tutorial-on-using-camel-in-a-web-application.html > > > > > > Bilgin > > > > -- > Claus Ibsen > ----------------- > FuseSource > Email: [hidden email] > Web: http://fusesource.com > Twitter: davsclaus, fusenews > Blog: http://davsclaus.com > Author of Camel in Action: http://www.manning.com/ibsen > |
|
The only issue I see is that you will be kind of implementing your own
"Spring-based" context. What are you trying to achieve by *NOT* using Spring? *Bruno Borges* (21) 7672-7099 *www.brunoborges.com* On Mon, Jun 25, 2012 at 1:54 PM, Bilgin Ibryam <[hidden email]> wrote: > Claus, > > I was thinking to use ServletContextListener and create/start > DefaultCamelContext when contextInitialized is called. The route I want to > use is quite simple, so I can create it straightforward. > > Then stop camelContext when contextDestroyed is called. > > Similar to running camel as standalone app with Main class. > > Do you see any issues with this approach? > > Thanks > Bilgin > > On 25 June 2012 16:55, Claus Ibsen <[hidden email]> wrote: > > > Hi > > > > How would you bootstrap Camel in the web app? > > > > For example using a servlet or context listener? > > But then how would it know which routes / and whatnot to include? > > > > I guess either some new fancy CDI or you would have to refer to a > > config file / java class or whatnot? > > > > > > On Mon, Jun 25, 2012 at 4:41 PM, Bilgin Ibryam <[hidden email]> > wrote: > > > Hi, > > > > > > is there any example or a helper class for running (starting/stopping) > > > Camel in a web-app without using Spring xml? > > > > > > There is an example servlet app [1] and a tutorial [2] for running > Camel > > in > > > a web-app, but both are using Spring > > > > > > [1] http://camel.apache.org/servlet-tomcat-example.html > > > [2] > > > > > > http://camel.apache.org/tutorial-on-using-camel-in-a-web-application.html > > > > > > > > > Bilgin > > > > > > > > -- > > Claus Ibsen > > ----------------- > > FuseSource > > Email: [hidden email] > > Web: http://fusesource.com > > Twitter: davsclaus, fusenews > > Blog: http://davsclaus.com > > Author of Camel in Action: http://www.manning.com/ibsen > > > |
|
Nothing special, we decided to use google-guice and I don't want to
introduce Spring in order to use Camel. And as Spring is not mandatory dependency for Camel any longer, it should be easy w/o it. Bilgin > What are you trying to achieve by *NOT* using Spring? > > *Bruno Borges* > (21) 7672-7099 > *www.brunoborges.com* > > > > On Mon, Jun 25, 2012 at 1:54 PM, Bilgin Ibryam <[hidden email]> wrote: > > > Claus, > > > > I was thinking to use ServletContextListener and create/start > > DefaultCamelContext when contextInitialized is called. The route I want > to > > use is quite simple, so I can create it straightforward. > > > > Then stop camelContext when contextDestroyed is called. > > > > Similar to running camel as standalone app with Main class. > > > > Do you see any issues with this approach? > > > > Thanks > > Bilgin > > > > On 25 June 2012 16:55, Claus Ibsen <[hidden email]> wrote: > > > > > Hi > > > > > > How would you bootstrap Camel in the web app? > > > > > > For example using a servlet or context listener? > > > But then how would it know which routes / and whatnot to include? > > > > > > I guess either some new fancy CDI or you would have to refer to a > > > config file / java class or whatnot? > > > > > > > > > On Mon, Jun 25, 2012 at 4:41 PM, Bilgin Ibryam <[hidden email]> > > wrote: > > > > Hi, > > > > > > > > is there any example or a helper class for running > (starting/stopping) > > > > Camel in a web-app without using Spring xml? > > > > > > > > There is an example servlet app [1] and a tutorial [2] for running > > Camel > > > in > > > > a web-app, but both are using Spring > > > > > > > > [1] http://camel.apache.org/servlet-tomcat-example.html > > > > [2] > > > > > > > > > > http://camel.apache.org/tutorial-on-using-camel-in-a-web-application.html > > > > > > > > > > > > Bilgin > > > > > > > > > > > > -- > > > Claus Ibsen > > > ----------------- > > > FuseSource > > > Email: [hidden email] > > > Web: http://fusesource.com > > > Twitter: davsclaus, fusenews > > > Blog: http://davsclaus.com > > > Author of Camel in Action: http://www.manning.com/ibsen > > > > > > |
|
In reply to this post by bibryam
You can also uses since camel 2.10, the camel-cdi component which allows to use a Context Dependency Injection container. Here is an example (https://github.com/cmoulliard/cdi-camel-example).
Regards, Charles Apache Commiter
Apache Committer / Sr. Pr. Consultant at FuseSource.com
Email: [hidden email] Twitter : @cmoulliard, @fusenews Blog : http://cmoulliard.blogspot.com |
| Powered by Nabble | Edit this page |
