osmman commented on code in PR #123:
URL: 
https://github.com/apache/camel-quarkus-examples/pull/123#discussion_r1032210168


##########
jms-jpa/README.adoc:
##########
@@ -0,0 +1,184 @@
+= JMS and JPA: A Camel Quarkus example
+:cq-example-description: An example that shows how to run a Camel Quarkus 
application that supports JTA transactions on three external transactional 
resources: a database (MySQL), a messaging broker (Artemis) and a simulated 
XAResource which can demonstrate the commit, rollback and crash recovery.
+
+{cq-description}
+
+We use Narayana as the standalone JTA Transaction Manager implementation, and 
Hibernate as the JPA Adapter.
+
+This example will connect to a database with the connection details defined in 
`application.properties`.
+If the example is run on Development mode and no database exists, Quarkus will 
create a matching database
+https://quarkus.io/guides/datasource#dev-services[as described here].
+
+TIP: Check the 
https://camel.apache.org/camel-quarkus/latest/first-steps.html[Camel Quarkus 
User guide] for prerequisites
+and other general information.
+
+NOTE: The Narayana `node.identifier` is very important when you scale up in 
the cloud environment. It must be unique for each node. You can set it by using 
`quarkus.transaction-manager.node-name` property which the default value is 
`quarkus`.
+
+== Start in the Development mode
+
+[source,shell]
+----
+$ mvn clean compile quarkus:dev
+----
+
+The above command compiles the project, starts the application and lets the 
Quarkus tooling watch for changes in your
+workspace. Any modifications in your project will automatically take effect in 
the running application.
+
+TIP: Please refer to the Development mode section of
+https://camel.apache.org/camel-quarkus/latest/first-steps.html#_development_mode[Camel
 Quarkus User guide] for more details.
+
+== Package and run the application
+
+Once you are done with developing you may want to package and run the 
application.
+
+TIP: Find more details about the JVM mode and Native mode in the Package and 
run section of
+https://camel.apache.org/camel-quarkus/latest/first-steps.html#_package_and_run_the_application[Camel
 Quarkus User guide]
+
+==== External systems
+
+Start MySQL:
+[source, shell]
+----
+docker run --name db-mysql \
+  -e MYSQL_ROOT_PASSWORD=root \
+  -d -p 3306:3306 mysql
+
+docker exec -it db-mysql mysql -uroot -proot -e \
+  "CREATE DATABASE testdb CHARACTER SET utf8mb4;
+   CREATE USER 'admin'@'%' IDENTIFIED WITH mysql_native_password BY 'admin';
+   GRANT ALL ON testdb.* TO 'admin'@'%';
+   GRANT XA_RECOVER_ADMIN on *.* to 'admin'@'%';
+   FLUSH PRIVILEGES;"
+----
+
+Start Artemis:
+[source, shell]
+----
+docker run --name artemis \
+  -e AMQ_USER=admin -e AMQ_PASSWORD=admin \
+  -d -p 61616:61616 \
+  quay.io/artemiscloud/activemq-artemis-broker
+----
+
+
+==== Prerequisites
+- Make sure `io.quarkus:quarkus-jdbc-mysql` has been added in `pom.xml`
+- Make sure `db-mysql` and `artemis` has been started and ready for servicing
+- Edit `src/main/resource/application.properties` to uncomment all `%prod` 
lines
+[source, properties]
+----
+# Production Datasource
+%prod.quarkus.datasource.db-kind=mysql
+%prod.quarkus.datasource.username=admin
+$prod.quarkus.datasource.password=admin
+%prod.quarkus.datasource.jdbc.url=mysql://localhost:3306/testdb
+%prod.quarkus.datasource.jdbc.transactions=xa
+
+%prod.quarkus.hibernate-orm.database.generation=none
+
+%prod.quarkus.artemis.url=tcp://localhost:61616
+%prod.quarkus.artemis.username=admin
+%prod.quarkus.artemis.password=admin
+----
+
+==== JVM mode
+
+[source,shell]
+----
+$ mvn clean package
+$ java -jar target/quarkus-app/quarkus-run.jar
+...
+
+[io.quarkus] (main) camel-quarkus-examples-... started in 0.570s.
+----
+
+==== Native mode
+
+IMPORTANT: Native mode requires having GraalVM and other tools installed. 
Please check the Prerequisites section
+of 
https://camel.apache.org/camel-quarkus/latest/first-steps.html#_prerequisites[Camel
 Quarkus User guide].
+
+To prepare a native executable using GraalVM, run the following command:
+
+[source,shell]
+----
+$ mvn clean package -Pnative
+$ ./target/*-runner
+...
+[io.quarkus] (main) camel-quarkus-examples-... started in 0.011s.
+...
+----
+
+==== How to run
+Test the service endpoint from another terminal:
+
+[source,shell]
+----
+ADDRESS="http://localhost:8080";
+curl -X POST $ADDRESS/api/messages/hello
+curl $ADDRESS/api/messages
+----
+
+Test with normal "hello" content:
+[source,shell]
+----
+curl -X POST $ADDRESS/api/message/hello

Review Comment:
   path should be `messages`



##########
jms-jpa/README.adoc:
##########
@@ -0,0 +1,184 @@
+= JMS and JPA: A Camel Quarkus example
+:cq-example-description: An example that shows how to run a Camel Quarkus 
application that supports JTA transactions on three external transactional 
resources: a database (MySQL), a messaging broker (Artemis) and a simulated 
XAResource which can demonstrate the commit, rollback and crash recovery.
+
+{cq-description}
+
+We use Narayana as the standalone JTA Transaction Manager implementation, and 
Hibernate as the JPA Adapter.
+
+This example will connect to a database with the connection details defined in 
`application.properties`.
+If the example is run on Development mode and no database exists, Quarkus will 
create a matching database
+https://quarkus.io/guides/datasource#dev-services[as described here].
+
+TIP: Check the 
https://camel.apache.org/camel-quarkus/latest/first-steps.html[Camel Quarkus 
User guide] for prerequisites
+and other general information.
+
+NOTE: The Narayana `node.identifier` is very important when you scale up in 
the cloud environment. It must be unique for each node. You can set it by using 
`quarkus.transaction-manager.node-name` property which the default value is 
`quarkus`.
+
+== Start in the Development mode
+
+[source,shell]
+----
+$ mvn clean compile quarkus:dev
+----
+
+The above command compiles the project, starts the application and lets the 
Quarkus tooling watch for changes in your
+workspace. Any modifications in your project will automatically take effect in 
the running application.
+
+TIP: Please refer to the Development mode section of
+https://camel.apache.org/camel-quarkus/latest/first-steps.html#_development_mode[Camel
 Quarkus User guide] for more details.
+
+== Package and run the application
+
+Once you are done with developing you may want to package and run the 
application.
+
+TIP: Find more details about the JVM mode and Native mode in the Package and 
run section of
+https://camel.apache.org/camel-quarkus/latest/first-steps.html#_package_and_run_the_application[Camel
 Quarkus User guide]
+
+==== External systems
+
+Start MySQL:
+[source, shell]
+----
+docker run --name db-mysql \
+  -e MYSQL_ROOT_PASSWORD=root \
+  -d -p 3306:3306 mysql
+
+docker exec -it db-mysql mysql -uroot -proot -e \
+  "CREATE DATABASE testdb CHARACTER SET utf8mb4;
+   CREATE USER 'admin'@'%' IDENTIFIED WITH mysql_native_password BY 'admin';
+   GRANT ALL ON testdb.* TO 'admin'@'%';

Review Comment:
   Please extend command to create audit_log table because you have 
`prod.quarkus.hibernate-orm.database.generation=none` configuration for `prod` 
profile.  



##########
jms-jpa/src/main/resources/application.properties:
##########
@@ -0,0 +1,54 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+#
+# Quarkus
+#
+quarkus.banner.enabled = false
+quarkus.log.file.enable = true
+
+# Default Datasource
+quarkus.datasource.db-kind=h2
+quarkus.datasource.jdbc.max-size=8
+quarkus.datasource.jdbc.transactions=xa
+
+# Production Datasource
+#%prod.quarkus.datasource.db-kind=mysql
+#%prod.quarkus.datasource.username=admin
+#%prod.quarkus.datasource.password=admin
+#%prod.quarkus.datasource.jdbc.url=jdbc:mysql://localhost:3306/testdb
+#%prod.quarkus.datasource.jdbc.transactions=xa
+
+# Hibernate ORM
+quarkus.hibernate-orm.database.generation=drop-and-create
+#%prod.quarkus.hibernate-orm.database.generation=none
+
+# Quarkus Narayana JTA
+quarkus.transaction-manager.object-store-directory=target/narayana
+quarkus.transaction-manager.enable-recovery=true
+
+# Camel
+camel.rest.context-path=/api
+
+# Quarkus Artemis
+quarkus.artemis.enabled=true
+quarkus.artemis.devservices.enabled=false

Review Comment:
   Why did you disable Artemis devservice? Datasource (H2) devservice is 
enabled and it make a confusion while I try to run `quarkus:dev`. I think that 
it will be better to keep it enabled as it is for Datasource service unless 
there is some technical problem.   



##########
jms-jpa/README.adoc:
##########
@@ -0,0 +1,184 @@
+= JMS and JPA: A Camel Quarkus example
+:cq-example-description: An example that shows how to run a Camel Quarkus 
application that supports JTA transactions on three external transactional 
resources: a database (MySQL), a messaging broker (Artemis) and a simulated 
XAResource which can demonstrate the commit, rollback and crash recovery.
+
+{cq-description}
+
+We use Narayana as the standalone JTA Transaction Manager implementation, and 
Hibernate as the JPA Adapter.
+
+This example will connect to a database with the connection details defined in 
`application.properties`.
+If the example is run on Development mode and no database exists, Quarkus will 
create a matching database
+https://quarkus.io/guides/datasource#dev-services[as described here].
+
+TIP: Check the 
https://camel.apache.org/camel-quarkus/latest/first-steps.html[Camel Quarkus 
User guide] for prerequisites
+and other general information.
+
+NOTE: The Narayana `node.identifier` is very important when you scale up in 
the cloud environment. It must be unique for each node. You can set it by using 
`quarkus.transaction-manager.node-name` property which the default value is 
`quarkus`.
+
+== Start in the Development mode
+
+[source,shell]
+----
+$ mvn clean compile quarkus:dev
+----
+
+The above command compiles the project, starts the application and lets the 
Quarkus tooling watch for changes in your
+workspace. Any modifications in your project will automatically take effect in 
the running application.
+
+TIP: Please refer to the Development mode section of
+https://camel.apache.org/camel-quarkus/latest/first-steps.html#_development_mode[Camel
 Quarkus User guide] for more details.
+
+== Package and run the application
+
+Once you are done with developing you may want to package and run the 
application.
+
+TIP: Find more details about the JVM mode and Native mode in the Package and 
run section of
+https://camel.apache.org/camel-quarkus/latest/first-steps.html#_package_and_run_the_application[Camel
 Quarkus User guide]
+
+==== External systems
+
+Start MySQL:
+[source, shell]
+----
+docker run --name db-mysql \
+  -e MYSQL_ROOT_PASSWORD=root \
+  -d -p 3306:3306 mysql
+
+docker exec -it db-mysql mysql -uroot -proot -e \
+  "CREATE DATABASE testdb CHARACTER SET utf8mb4;
+   CREATE USER 'admin'@'%' IDENTIFIED WITH mysql_native_password BY 'admin';
+   GRANT ALL ON testdb.* TO 'admin'@'%';
+   GRANT XA_RECOVER_ADMIN on *.* to 'admin'@'%';
+   FLUSH PRIVILEGES;"
+----
+
+Start Artemis:
+[source, shell]
+----
+docker run --name artemis \
+  -e AMQ_USER=admin -e AMQ_PASSWORD=admin \
+  -d -p 61616:61616 \
+  quay.io/artemiscloud/activemq-artemis-broker
+----
+
+
+==== Prerequisites
+- Make sure `io.quarkus:quarkus-jdbc-mysql` has been added in `pom.xml`
+- Make sure `db-mysql` and `artemis` has been started and ready for servicing
+- Edit `src/main/resource/application.properties` to uncomment all `%prod` 
lines
+[source, properties]
+----
+# Production Datasource
+%prod.quarkus.datasource.db-kind=mysql
+%prod.quarkus.datasource.username=admin
+$prod.quarkus.datasource.password=admin
+%prod.quarkus.datasource.jdbc.url=mysql://localhost:3306/testdb
+%prod.quarkus.datasource.jdbc.transactions=xa
+
+%prod.quarkus.hibernate-orm.database.generation=none
+
+%prod.quarkus.artemis.url=tcp://localhost:61616
+%prod.quarkus.artemis.username=admin
+%prod.quarkus.artemis.password=admin
+----
+
+==== JVM mode
+
+[source,shell]
+----
+$ mvn clean package
+$ java -jar target/quarkus-app/quarkus-run.jar
+...
+
+[io.quarkus] (main) camel-quarkus-examples-... started in 0.570s.
+----
+
+==== Native mode
+
+IMPORTANT: Native mode requires having GraalVM and other tools installed. 
Please check the Prerequisites section
+of 
https://camel.apache.org/camel-quarkus/latest/first-steps.html#_prerequisites[Camel
 Quarkus User guide].
+
+To prepare a native executable using GraalVM, run the following command:
+
+[source,shell]
+----
+$ mvn clean package -Pnative
+$ ./target/*-runner
+...
+[io.quarkus] (main) camel-quarkus-examples-... started in 0.011s.
+...
+----
+
+==== How to run
+Test the service endpoint from another terminal:
+
+[source,shell]
+----
+ADDRESS="http://localhost:8080";
+curl -X POST $ADDRESS/api/messages/hello
+curl $ADDRESS/api/messages
+----
+
+Test with normal "hello" content:
+[source,shell]
+----
+curl -X POST $ADDRESS/api/message/hello
+----
+
+Check the audit_log
+[source,shell]
+----
+curl $ADDRESS/api/messages
+----
+You should get some results like
+[source]
+----
+[{message=hello}, {message=hello-ok}]
+----
+
+Test rollback by calling the service with "fail" content:
+[source,shell]
+----
+curl -X POST $ADDRESS/api/message/fail

Review Comment:
   path should be messages



##########
jms-jpa/README.adoc:
##########
@@ -0,0 +1,184 @@
+= JMS and JPA: A Camel Quarkus example
+:cq-example-description: An example that shows how to run a Camel Quarkus 
application that supports JTA transactions on three external transactional 
resources: a database (MySQL), a messaging broker (Artemis) and a simulated 
XAResource which can demonstrate the commit, rollback and crash recovery.
+
+{cq-description}
+
+We use Narayana as the standalone JTA Transaction Manager implementation, and 
Hibernate as the JPA Adapter.
+
+This example will connect to a database with the connection details defined in 
`application.properties`.
+If the example is run on Development mode and no database exists, Quarkus will 
create a matching database
+https://quarkus.io/guides/datasource#dev-services[as described here].
+
+TIP: Check the 
https://camel.apache.org/camel-quarkus/latest/first-steps.html[Camel Quarkus 
User guide] for prerequisites
+and other general information.
+
+NOTE: The Narayana `node.identifier` is very important when you scale up in 
the cloud environment. It must be unique for each node. You can set it by using 
`quarkus.transaction-manager.node-name` property which the default value is 
`quarkus`.
+
+== Start in the Development mode
+
+[source,shell]
+----
+$ mvn clean compile quarkus:dev
+----
+
+The above command compiles the project, starts the application and lets the 
Quarkus tooling watch for changes in your
+workspace. Any modifications in your project will automatically take effect in 
the running application.
+
+TIP: Please refer to the Development mode section of
+https://camel.apache.org/camel-quarkus/latest/first-steps.html#_development_mode[Camel
 Quarkus User guide] for more details.
+
+== Package and run the application
+
+Once you are done with developing you may want to package and run the 
application.
+
+TIP: Find more details about the JVM mode and Native mode in the Package and 
run section of
+https://camel.apache.org/camel-quarkus/latest/first-steps.html#_package_and_run_the_application[Camel
 Quarkus User guide]
+
+==== External systems
+
+Start MySQL:
+[source, shell]
+----
+docker run --name db-mysql \
+  -e MYSQL_ROOT_PASSWORD=root \
+  -d -p 3306:3306 mysql
+
+docker exec -it db-mysql mysql -uroot -proot -e \
+  "CREATE DATABASE testdb CHARACTER SET utf8mb4;
+   CREATE USER 'admin'@'%' IDENTIFIED WITH mysql_native_password BY 'admin';
+   GRANT ALL ON testdb.* TO 'admin'@'%';
+   GRANT XA_RECOVER_ADMIN on *.* to 'admin'@'%';
+   FLUSH PRIVILEGES;"
+----
+
+Start Artemis:
+[source, shell]
+----
+docker run --name artemis \
+  -e AMQ_USER=admin -e AMQ_PASSWORD=admin \
+  -d -p 61616:61616 \
+  quay.io/artemiscloud/activemq-artemis-broker
+----
+
+
+==== Prerequisites
+- Make sure `io.quarkus:quarkus-jdbc-mysql` has been added in `pom.xml`
+- Make sure `db-mysql` and `artemis` has been started and ready for servicing
+- Edit `src/main/resource/application.properties` to uncomment all `%prod` 
lines

Review Comment:
   I think it's unnecessary to have commented rows with `%prod` because Quarkus 
automatically selects the profile it has. So properties from the `%prod` 
profile will not be used for tests or dev mode.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to