Skip to content

Instantly share code, notes, and snippets.

@marcelmaatkamp
Created April 25, 2010 14:32
Show Gist options
  • Save marcelmaatkamp/378443 to your computer and use it in GitHub Desktop.
Save marcelmaatkamp/378443 to your computer and use it in GitHub Desktop.
#!/usr/bin/env groovy
import org.apache.camel.*
@Grapes([
@Grab('org.springframework:spring:2.5.6'),
@Grab('org.apache.camel:camel-core:2.2.0'),
@GrabConfig(systemClassLoader = true)
])
// define route
class MyRouteBuilder extends org.apache.camel.builder.RouteBuilder {
void configure() {
from("direct://foo").to("mock://result")
}
}
def mrb = new MyRouteBuilder()
def ctx = new org.apache.camel.impl.DefaultCamelContext()
ctx.addRoutes mrb
ctx.start()
def p = ctx.createProducerTemplate()
p.sendBody "direct:foo", "Camel Ride for beginner"
def e = ctx.getEndpoint("mock://result")
def ex = e.exchanges.first()
println "INFO> ${ex}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment