Skip to content

Commit

Permalink
chore: start with a simple stream example
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmorais committed Jul 10, 2022
1 parent 83cbcc6 commit 73d6b23
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 0 deletions.
36 changes: 36 additions & 0 deletions data-probe/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>f1-data</artifactId>
<groupId>com.mrmorais</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>f1-data-dataprobe</artifactId>

<properties>
<maven.compiler.source>18</maven.compiler.source>
<maven.compiler.target>18</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>3.18.0</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-stream</artifactId>
<version>3.18.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.36</version>
</dependency>
</dependencies>
</project>
40 changes: 40 additions & 0 deletions data-probe/src/main/java/com/mrmorais/f122/StreamExample.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.mrmorais.f122;

import org.apache.camel.CamelContext;
import org.apache.camel.impl.DefaultCamelContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.CountDownLatch;

public class StreamExample {
private final static Logger log = LoggerFactory.getLogger(StreamExample.class);

public static void main(String[] args) throws Exception {
CamelContext camelContext = new DefaultCamelContext();

camelContext.addRoutes(new StreamInOutBuilder());

CountDownLatch latch = new CountDownLatch(1);

Runtime.getRuntime().addShutdownHook(new Thread(() -> {
try {
camelContext.close();
} catch (Exception e) {
log.error("Error closing CamelContext", e);
} finally {
latch.countDown();
}
}));

try {
camelContext.start();
latch.await();
} catch (Throwable e) {
log.error("Error starting CamelContext", e);
System.exit(1);
}

System.exit(0);
}
}
11 changes: 11 additions & 0 deletions data-probe/src/main/java/com/mrmorais/f122/StreamInOutBuilder.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.mrmorais.f122;

import org.apache.camel.builder.RouteBuilder;

public class StreamInOutBuilder extends RouteBuilder {

@Override
public void configure() {
from("stream:in").to("stream:out");
}
}
20 changes: 20 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.mrmorais</groupId>
<artifactId>f1-data</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>telemetry</module>
<module>data-probe</module>
</modules>

<properties>
<maven.compiler.source>18</maven.compiler.source>
<maven.compiler.target>18</maven.compiler.target>
</properties>
</project>
19 changes: 19 additions & 0 deletions telemetry/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>f1-data</artifactId>
<groupId>com.mrmorais</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>f1-data-telemetry</artifactId>

<properties>
<maven.compiler.source>18</maven.compiler.source>
<maven.compiler.target>18</maven.compiler.target>
</properties>

</project>

0 comments on commit 73d6b23

Please sign in to comment.