You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2024/01/31 17:28:37 UTC
(camel-quarkus-examples) 02/12: Triggering time less often and fixing README.adoc (#186)
This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus-examples.git
commit b168ba42a96c3e9537e6f5a2b5cb71329b7830eb
Author: shravani <sp...@redhat.com>
AuthorDate: Wed Nov 29 20:21:54 2023 +0530
Triggering time less often and fixing README.adoc (#186)
---
jdbc-datasource/README.adoc | 6 +++++-
jdbc-datasource/src/main/java/org/acme/jdbc/JdbcRoutes.java | 2 +-
jdbc-datasource/src/main/resources/application.properties | 2 ++
.../test/java/org/acme/jdbc/PostgresSourceDatabaseTestResource.java | 4 +++-
.../test/java/org/acme/jdbc/PostgresTargetDatabaseTestResource.java | 4 +++-
5 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/jdbc-datasource/README.adoc b/jdbc-datasource/README.adoc
index b32eb02..1f9cfaa 100644
--- a/jdbc-datasource/README.adoc
+++ b/jdbc-datasource/README.adoc
@@ -9,6 +9,10 @@ and other general information.
== Start the source and target databases
All the commands in this example are expected to be run from the example directory, at the same level than the `pom.xml` file.
+[source,shell]
+----
+cd jdbc-datasource
+----
In a first terminal, let's start the source database by executing the command below:
@@ -106,7 +110,7 @@ Or, if you don't have GraalVM installed, you can run the native executable build
mvn package -Dnative -Dquarkus.native.container-build=true
----
-Either way, the resulting native executable could be start as below:
+Either way, the resulting native executable could be started as below:
[source,shell]
----
diff --git a/jdbc-datasource/src/main/java/org/acme/jdbc/JdbcRoutes.java b/jdbc-datasource/src/main/java/org/acme/jdbc/JdbcRoutes.java
index 3afa331..27e2fe9 100644
--- a/jdbc-datasource/src/main/java/org/acme/jdbc/JdbcRoutes.java
+++ b/jdbc-datasource/src/main/java/org/acme/jdbc/JdbcRoutes.java
@@ -30,7 +30,7 @@ public class JdbcRoutes extends RouteBuilder {
reviewMapping.put("good", 0);
reviewMapping.put("worst", -1);
- from("timer://insertCamel?period=1000&repeatCount={{etl.timer.repeatcount}}")
+ from("timer://insertCamel?delay={{etl.timer.delay}}&period={{etl.timer.period}}&repeatCount={{etl.timer.repeatcount}}")
.setBody().simple("DELETE FROM Target")
.to("jdbc:target_db")
.setBody().simple("SELECT * FROM Source")
diff --git a/jdbc-datasource/src/main/resources/application.properties b/jdbc-datasource/src/main/resources/application.properties
index 706c31d..d5ff331 100644
--- a/jdbc-datasource/src/main/resources/application.properties
+++ b/jdbc-datasource/src/main/resources/application.properties
@@ -22,6 +22,8 @@ quarkus.log.file.enable = true
# Set how many time the route should be applied
etl.timer.repeatcount = 0
+etl.timer.period = 10000
+etl.timer.delay = 1000
%test.etl.timer.repeatCount = 1
# Source Database Configuration
diff --git a/jdbc-datasource/src/test/java/org/acme/jdbc/PostgresSourceDatabaseTestResource.java b/jdbc-datasource/src/test/java/org/acme/jdbc/PostgresSourceDatabaseTestResource.java
index b0f9a14..fe0335d 100644
--- a/jdbc-datasource/src/test/java/org/acme/jdbc/PostgresSourceDatabaseTestResource.java
+++ b/jdbc-datasource/src/test/java/org/acme/jdbc/PostgresSourceDatabaseTestResource.java
@@ -61,7 +61,9 @@ public class PostgresSourceDatabaseTestResource<T extends GenericContainer> impl
sourceDbContainer.getMappedPort(POSTGRES_PORT), POSTGRES_SOURCE_DB_NAME);
LOG.info("The test source_db could be accessed through the following JDBC url: " + sourceJbdcUrl);
- return mapOf("quarkus.datasource.source_db.jdbc.url", sourceJbdcUrl);
+ return mapOf("quarkus.datasource.source_db.jdbc.url", sourceJbdcUrl,
+ "timer.period", "100",
+ "timer.delay", "0");
}
@Override
diff --git a/jdbc-datasource/src/test/java/org/acme/jdbc/PostgresTargetDatabaseTestResource.java b/jdbc-datasource/src/test/java/org/acme/jdbc/PostgresTargetDatabaseTestResource.java
index 3f67ff1..dd79137 100644
--- a/jdbc-datasource/src/test/java/org/acme/jdbc/PostgresTargetDatabaseTestResource.java
+++ b/jdbc-datasource/src/test/java/org/acme/jdbc/PostgresTargetDatabaseTestResource.java
@@ -61,7 +61,9 @@ public class PostgresTargetDatabaseTestResource<T extends GenericContainer> impl
targetDbContainer.getMappedPort(POSTGRES_PORT), POSTGRES_TARGET_DB_NAME);
LOG.info("The test target_db could be accessed through the following JDBC url: " + targetJbdcUrl);
- return mapOf("quarkus.datasource.target_db.jdbc.url", targetJbdcUrl);
+ return mapOf("quarkus.datasource.target_db.jdbc.url", targetJbdcUrl,
+ "timer.period", "100",
+ "timer.delay", "0");
}
@Override