Skip to content

Commit 42e0752

Browse files
author
Vitalii Cherkashyn
committed
groovy camel example
1 parent 7fa049b commit 42e0752

File tree

6 files changed

+141
-0
lines changed

6 files changed

+141
-0
lines changed

groovy/camel/camel.groovy

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import org.apache.camel.builder.RouteBuilder;
2+
3+
// import org.apache.camel.cdi.Main;
4+
import org.apache.camel.main.Main;
5+
6+
public class TimerRouteBuilder extends RouteBuilder {
7+
8+
@Override
9+
public void configure() throws Exception {
10+
11+
from('timer:tick?period=3000')
12+
.setBody().constant('Hello world from Camel K')
13+
.to('log:info')
14+
15+
}
16+
17+
}
18+
19+
println "start"
20+
Main main = new Main();
21+
main.addRouteBuilder(new TimerRouteBuilder());
22+
main.run([]);
23+
main.close();
24+
25+
println "finish"

groovy/camel/pom.xml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<packaging>jar</packaging>
5+
<version>1.0-SNAPSHOT</version>
6+
<name>workplace</name>
7+
<url>http://maven.apache.org</url>
8+
9+
<groupId>com.cherkashyn.vitalii.startup.searchcorrector</groupId>
10+
<artifactId>workplace</artifactId>
11+
12+
<build>
13+
<plugins>
14+
<plugin>
15+
<groupId>org.codehaus.gmavenplus</groupId>
16+
<artifactId>gmavenplus-plugin</artifactId>
17+
<version>1.9.0</version>
18+
<executions>
19+
<execution>
20+
<goals>
21+
<goal>addSources</goal>
22+
<goal>addTestSources</goal>
23+
<goal>compile</goal>
24+
<goal>compileTests</goal>
25+
<goal>execute</goal>
26+
</goals>
27+
</execution>
28+
</executions>
29+
<configuration>
30+
<scripts>
31+
<script>file:///${project.basedir}/camel.groovy</script>
32+
</scripts>
33+
</configuration>
34+
</plugin>
35+
</plugins>
36+
</build>
37+
38+
<dependencies>
39+
<dependency>
40+
<groupId>org.codehaus.groovy</groupId>
41+
<artifactId>groovy-all</artifactId>
42+
<!-- any version of Groovy \>= 1.5.0 should work here -->
43+
<version>3.0.3</version>
44+
<type>pom</type>
45+
</dependency>
46+
47+
<!-- https://mvnrepository.com/artifact/org.apache.camel/camel-core -->
48+
<dependency>
49+
<groupId>org.apache.camel</groupId>
50+
<artifactId>camel-core</artifactId>
51+
<version>3.3.0</version>
52+
</dependency>
53+
54+
<!-- https://mvnrepository.com/artifact/org.apache.camel/camel-groovy -->
55+
<dependency>
56+
<groupId>org.apache.camel</groupId>
57+
<artifactId>camel-groovy</artifactId>
58+
<version>3.3.0</version>
59+
</dependency>
60+
61+
</dependencies>
62+
63+
</project>

groovy/camel/start-application.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# https://github.com/groovy/GMavenPlus/wiki/Examples
2+
mvn gplus:execute
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
println "hello"

groovy/mvn-plugin/pom.xml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<packaging>jar</packaging>
5+
<version>1.0-SNAPSHOT</version>
6+
<name>workplace</name>
7+
<url>http://maven.apache.org</url>
8+
9+
<groupId>com.cherkashyn.vitalii.startup.searchcorrector</groupId>
10+
<artifactId>workplace</artifactId>
11+
12+
<build>
13+
<plugins>
14+
<plugin>
15+
<groupId>org.codehaus.gmavenplus</groupId>
16+
<artifactId>gmavenplus-plugin</artifactId>
17+
<version>1.9.0</version>
18+
<executions>
19+
<execution>
20+
<goals>
21+
<goal>addSources</goal>
22+
<goal>addTestSources</goal>
23+
<goal>compile</goal>
24+
<goal>compileTests</goal>
25+
<goal>execute</goal>
26+
</goals>
27+
</execution>
28+
</executions>
29+
<configuration>
30+
<scripts>
31+
<script>file:///${project.basedir}/console-output.groovy</script>
32+
</scripts>
33+
</configuration>
34+
</plugin>
35+
</plugins>
36+
</build>
37+
38+
<dependencies>
39+
<dependency>
40+
<groupId>org.codehaus.groovy</groupId>
41+
<artifactId>groovy-all</artifactId>
42+
<!-- any version of Groovy \>= 1.5.0 should work here -->
43+
<version>3.0.3</version>
44+
<type>pom</type>
45+
</dependency>
46+
</dependencies>
47+
48+
</project>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# https://github.com/groovy/GMavenPlus/wiki/Examples
2+
mvn gplus:execute

0 commit comments

Comments
 (0)