2009/5/22 EwanH <[email protected]>: > > Ok I have it sussed now... > > I am using Lift as my web framework and want to incorporate camel for > routing using scala which works fine when I create my own > DefaultCamelContext and add routes manually.
FWIW I've recently been using Lift with Jersey/JAXRS - I've got the templates working nicely http://github.com/jstrachan/liftweb/tree/master/lift-jersey/ at some point I'd like to port camel-web to Lift which would show Lift, Jersey, Camel and Spring all working nicely together (the latter being optional). > But if I choose to have the > camel context bootstrapped by the standard spring listener I could not find > a way as Lift does not use Spring. You could lookup the CamelContext as well BTW in the spring ApplicationContext - if you had... <camelContext id="myCamel" xmlns="http://activemq.apache.org/camel/schema/spring"> <package>myapp.routes</package> </camelContext> then you can lookup "myCamel" (IIRC the default ID is "camelContext") > My solution is a scala singleton that calls out to Spring to look up the > template and magically it all works > > object RouteBuilderHelper { > > lazy val context = ContextLoader.getCurrentWebApplicationContext() > lazy val template: ProducerTemplate[Exchange] = > context.getBean("myTemplate").asInstanceOf[ProducerTemplate[Exchange]] > > def getTemplate() = template > } > > ... SomeOtherClass.scala below: > > Log.info("Running camel route direct:testMe") > val p = RouteBuilderHelper.getTemplate > > for (i <- 1 to 10) { > p.sendBody("direct:testMe", "****Test Message #" + i); > } > > I can see that using WebApplicationContextUtils will work as well. > > Now the problem I have now is that shutdown hooks in Jetty, while seemingly > called (log message say INFO: Shutdown hook executing) results in the > process hanging. I wonder if a debugger/profiler/thread dump can tell you whats causing the block? Some blocked request/reply in a route? -- James ------- http://macstrac.blogspot.com/ Open Source Integration http://fusesource.com/
