Last active
August 29, 2015 14:00
-
-
Save grimrose/11037373 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'java' | |
apply plugin: 'idea' | |
/* | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
compile 'org.apache.camel:camel-core:2.13.0' | |
compile 'org.slf4j:slf4j-simple:1.7.6' | |
testCompile "junit:junit:4.11" | |
} | |
*/ | |
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath 'org.apache.camel:camel-core:2.13.0' | |
classpath 'org.slf4j:slf4j-simple:1.7.6' | |
} | |
} | |
import org.apache.camel.builder.RouteBuilder | |
import org.apache.camel.impl.DefaultCamelContext | |
task fileCopierWithCamel << { | |
def context = new DefaultCamelContext() | |
context.addRoutes(new RouteBuilder() { | |
public void configure() { | |
from("file:data/inbox?noop=true") | |
.to("log://camelLogger?level=INFO") | |
.to("file:data/outbox") | |
} | |
}) | |
context.start() | |
Thread.sleep(60000) | |
context.stop() | |
} | |
task timerCamelTask << { | |
def context = new DefaultCamelContext() | |
context.addRoutes(new RouteBuilder() { | |
public void configure() { | |
from("timer://jdkTimer?period=3000") | |
.to("log://camelLogger?level=INFO") | |
} | |
}) | |
context.start() | |
addShutdownHook { context.stop() } | |
synchronized (this) { | |
this.wait() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment