You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: jpa-idempotent-repository/README.adoc
+16-56
Original file line number
Diff line number
Diff line change
@@ -64,46 +64,23 @@ The camel application should produce logs as below:
64
64
2023-09-15 15:48:20,804 INFO [org.acm.jpa.ide.rep.CostlyApiService] (vert.x-worker-thread-1) Costly API has been called with new content => GOOD
65
65
----
66
66
67
-
When running in dev mode, the idempotent consumer is storing the list of already processed messages in-memory, into a h2 database.
68
-
Later on, another database will be used when we'll package and run the application.
69
-
Indeed, the duplicate messages will then be stored in files, into a derby database.
67
+
The idempotent consumer is storing the list of already processed messages into a MariaDB database.
70
68
71
-
== Starting and initializing the derby database in a container
69
+
If you're wondering how the database schema was created, it happens automatically thanks to `quarkus-flyway`. On application startup, it
70
+
creates the `my-db` database and the required `CAMEL_MESSAGEPROCESSED` table. You can find the Flyway migration script at `src/main/resources/db/migration/V1.0.0__add_camel_message_processed.sql`.
71
+
You can find more information about Flyway in the https://quarkus.io/guides/flyway[Quarkus Flyway guide].
72
72
73
-
Before packaging and running the application in JVM mode, we need to start and initialize a derby database in a container.
74
-
So, in a first shell, please launch a derby database container:
73
+
== Starting and initializing the MariaDB database in a container
75
74
76
-
[source,shell]
77
-
----
78
-
docker run -p 1527:1527 az82/docker-derby:10.16
79
-
----
80
-
81
-
And from a second shell, please run the commands below in order to initialize the derby database:
75
+
Before packaging and running the application in JVM mode, we need to start and initialize a MariaDB database in a container.
76
+
So, in a first shell, please launch a MariaDB database container:
ij> CREATE SEQUENCE CAMEL_MESSAGEPROCESSED_SEQ AS INT MAXVALUE 999999 CYCLE;
105
-
0 rows inserted/updated/deleted
106
-
----
83
+
If successful, you should see the message `mariadbd: ready for connections` output to the console.
107
84
108
85
=== Package and run the application
109
86
@@ -120,26 +97,7 @@ mvn clean package -DskipTests
120
97
java -jar target/quarkus-app/quarkus-run.jar
121
98
----
122
99
123
-
Please, note that the shell running the derby database should react by printing some logs as below:
124
-
125
-
[source,shell]
126
-
----
127
-
Booting Derby version The Apache Software Foundation - Apache Derby - 10.16.1.1 - (1901046): instance a816c00e-018a-996e-54bf-00003e718008
128
-
on database directory /dbs/my-db with class loader jdk.internal.loader.ClassLoaders$AppClassLoader@5c626da3
129
-
Loaded from file:/derby/lib/derby.jar
130
-
java.vendor=Eclipse Adoptium
131
-
java.runtime.version=17.0.4.1+1
132
-
user.dir=/dbs
133
-
os.name=Linux
134
-
os.arch=amd64
135
-
os.version=4.18.0-477.21.1.el8_8.x86_64
136
-
derby.system.home=null
137
-
derby.stream.error.field=java.lang.System.out
138
-
Database Class Loader started - derby.database.classpath=''
139
-
----
140
-
141
-
Beyond that, notice how the application behaves the same way.
142
-
The only variation compared to the dev mode is actually that the idempotent repository is now a derby database running in a container.
100
+
As mentioned above, `quarkus-flyway` will automatically create the required database and tables for you.
143
101
144
102
==== Native mode
145
103
@@ -184,12 +142,14 @@ Check pods are running by executing:
184
142
kubectl get pods
185
143
----
186
144
187
-
We expect a list of two pods similar to below:
145
+
We expect a list of three pods similar to below.
146
+
Note that the `camel-quarkus-examples-jpa-idempotent-repository-flyway` pod will transition from `running` to `completed`, after it has completed initializing the MariaDB database.
0 commit comments