On Sun, Nov 14, 2010 at 6:45 PM, Tommy Chheng <[email protected]> wrote: > Hi Claus, > In Section 13.4.1, the reference to shutting down the application when the > route is done processing is : > Main main = new Main(); > main.setApplicationContextUri("META-INF/spring/camel-context.xml"); > main.enableHangupSupport(); > main.start(); > > But this requires using spring? >
Yes > Is it possible to shutdown without using the Thread.sleep method(since i > don't know how long it will take) or spring? > Yeah but then you need to code the pieces yourself. Take a look in the source code for camel-spring, where you can see how the enableHangupSupport method has been implemented. You gotta do something like that. https://svn.apache.org/repos/asf/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java However I have created a ticket so we will add this to camel-core in the future so its easier to do out of the box. > Thanks for the help, I'm glad i stumbled across camel. It looks like an > easier way of transforming different data sources into different sinks. > > @tommychheng > > > On 11/14/10 12:56 AM, Claus Ibsen wrote: >> >> On Sun, Nov 14, 2010 at 9:54 AM, Tommy Chheng<[email protected]> >> wrote: >>> >>> I just got the camel in action book and saw the example in chap 1. >>> >>> I needed a Thread.sleep(10000) right after context.start so: >>> context.start >>> Thread.sleep(10000) >>> context.stop >>> >>> Is there a blocking stop method where the program would end when the >>> process >>> is done? >>> >> See chapter 13, section 13.4.1. >> >>> On 11/14/10 12:42 AM, Claus Ibsen wrote: >>>> >>>> Hi >>>> >>>> Try just first without the filter, to see that it creates the output >>>> files. >>>> Then add back the filter and you then know the xpath returns false for >>>> all the input files. >>>> Hence its most likely your xpath expression which is wrong. >>>> >>>> >>>> On Sun, Nov 14, 2010 at 9:02 AM, Tommy Chheng<[email protected]> >>>> wrote: >>>>> >>>>> I'm trying to use Camel to extract only the "//title" tag in a >>>>> directory >>>>> of >>>>> xml files. This is all on local disk. >>>>> The code runs sucessfully without an error but there was no directory >>>>> created. Any ideas whats wrong? >>>>> >>>>> import org.apache.camel.builder.RouteBuilder >>>>> import org.apache.camel.impl.DefaultCamelContext >>>>> class xmlFilter extends RouteBuilder { >>>>> def configure { >>>>> val inputDir = "file://~/src/rw/data/xml/original" >>>>> val outputDir = "file:title_only" >>>>> >>>>> //apache camel dsl >>>>> from(inputDir).filter().xpath("//title").to(outputDir) >>>>> } >>>>> } >>>>> >>>>> object CamelExample{ >>>>> def run{ >>>>> val context = new DefaultCamelContext() >>>>> context.addRoutes(new xmlFilter()) >>>>> context.start() >>>>> } >>>>> } >>>>> >>>>> CamelExample.run >>>>> >>>> >> >> > -- Claus Ibsen ----------------- FuseSource Email: [email protected] Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
