Skip to content

Instantly share code, notes, and snippets.

@gfrison
Created November 8, 2011 13:53
Show Gist options
  • Save gfrison/1347781 to your computer and use it in GitHub Desktop.
Save gfrison/1347781 to your computer and use it in GitHub Desktop.
groovy camel builder script
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.language.groovy.GroovyRouteBuilder;
import org.apache.camel.*
@Grab(group='org.slf4j', module='slf4j-api', version='1.6.1')
@Grab(group='org.slf4j', module='slf4j-log4j12', version='1.6.1')
@Grab(group='org.apache.camel', module='camel-groovy', version='2.8.0')
@Grab(group='org.apache.camel', module='camel-core', version='2.8.0')
@Grab(group='org.apache.camel', module='camel-jetty', version='2.8.0')
class SampleRoute extends GroovyRouteBuilder {
protected void configure(){
def log = {ex-> println ex?.toString()} as Processor
from("file:///home/gfrison/tmp/").process(log)
from("jetty:http://localhost:3001/parse?disableStreamCache=true").convertBodyTo(String.class).process(log)
}
}
def main = new Main()
main.enableHangupSupport()
main.addRouteBuilder(new SampleRoute())
main.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment