You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "avano (via GitHub)" <gi...@apache.org> on 2023/10/11 08:23:20 UTC

[PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

avano opened a new pull request, #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165

   (no comment)


-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "avano (via GitHub)" <gi...@apache.org>.
avano commented on PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#issuecomment-1764279191

   I updated the example with:
   - added crash recovery scenario
   - added openshift deployment steps
   - switched tests to integration tests with testcontainers
   - added ^ to readme


-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1361938990


##########
message-bridge/README.adoc:
##########
@@ -0,0 +1,206 @@
+= Message Bridge: A Camel Quarkus example
+:cq-example-description: An example that shows how to configure AMQ and IBM MQ clients to use the connection pooling and XA transactions.
+
+{cq-description}
+
+TIP: Check the https://camel.apache.org/camel-quarkus/latest/first-steps.html[Camel Quarkus User guide] for prerequisites
+and other general information.
+
+== Overview
+
+In this example, a basic REST endpoint is provided for users to dispatch a message to the IBM MQ queue. Subsequently, all messages from the IBM MQ are relayed to an ActiveMQ queue within an XA transaction. To showcase the transaction functionality, a message containing the keyword "rollback" will initiate a transaction rollback. To demonstrate the process of a transaction recovery after a crash, send a message with they keyword "crash".
+
+Details regarding client configurations can be located in the `src/main/resources/application.properties` file.
+
+== Prerequisites
+
+First start the ActiveMQ broker:
+----
+docker run \
+  -d \
+  -e AMQ_USER=admin \
+  -e AMQ_PASSWORD=admin \
+  -p 61616:61616 \
+  quay.io/artemiscloud/activemq-artemis-broker
+----
+
+Then start the IBM MQ broker:
+----
+docker run \
+  -d \
+  -e LICENSE=accept \
+  -e MQ_QMGR_NAME=QM1 \
+  -e MQ_APP_PASSWORD=passw0rd \
+  -p 1414:1414 \
+  icr.io/ibm-messaging/mq:9.3.2.1-r1
+----
+
+== 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.
+
+After the application is started, you can send messages to the IBMMQ queue using the rest endpoint `/message`:
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello World'
+----
+
+In the application logs you will see:
+
+----
+2023-10-11 08:10:52,782 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello World
+2023-10-11 08:10:52,903 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello World
+2023-10-11 08:10:52,927 INFO  [amq] (Camel (camel-4) thread #8 - JmsConsumer[in]) ActiveMQ received: Hello World
+----
+
+The message is initially dispatched to an IBMMQ queue, then relayed to an ActiveMQ queue, and ultimately retrieved from the ActiveMQ queue and printed to the log without any issues.
+
+=== Transaction rollback
+
+If you wish to illustrate a rollback, simply send a message containing the `rollback` keyword.
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello rollback'
+----
+The log could be divided into two segments. In this demonstration, the IBMMQ to ActiveMQ route is configured to simulate a transaction rollback following the dispatch of a message to the ActiveMQ queue. Due to the rollback, you'll notice that the message isn't fetched from the ActiveMQ queue and isn't logged:
+
+----
+2023-10-11 08:12:46,314 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello rollback
+2023-10-11 08:12:46,453 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello rollback
+2023-10-11 08:12:46,457 WARN  [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Transaction rollback (0xea2b886) redelivered(false) for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003) caught: Simulated rollback
+2023-10-11 08:12:46,458 ERROR [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Failed delivery for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003). Exhausted after delivery attempt: 1 caught: java.lang.RuntimeException: Simulated rollback
+...
+<truncated exception from the simulated rollback>
+----
+
+Because the transaction was rolled back, the message wasn't successfully processed and it is returned to the IBMMQ queue and subsequently redelivered. In this instance, the delivery is successful and logged accordingly:
+
+----
+2023-10-11 08:12:46,561 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Redelivering message after rollback to ActiveMQ: Hello rollback
+2023-10-11 08:12:46,567 INFO  [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Transaction commit (0xea2b886) redelivered(true) for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000004))
+2023-10-11 08:12:46,585 INFO  [amq] (Camel (camel-4) thread #8 - JmsConsumer[in]) ActiveMQ received: Hello rollback
+----
+
+In this example, a local file transaction storage is used, which is set up through the `quarkus.transaction-manager.object-store.directory` property. If you prefer to utilize a database for configuring the storage, please refer to the Quarkus transactions guide available at https://quarkus.io/guides/transaction#jdbcstore.
+
+=== Transaction recovery
+
+To trigger a JVM crash during the transaction, send a message containing the word `crash`.
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello crash'
+----
+
+This will result in the JVM stopping abruptly:
+
+----
+2023-10-13 15:21:03,277 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: crash
+2023-10-13 15:21:03,429 INFO  [ibmmq-amq] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: crash
+2023-10-13 15:21:03,449 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Preparing DummyXAResource
+2023-10-13 15:21:03,461 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Committing DummyXAResource
+2023-10-13 15:21:03,461 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Crashing the system
+----
+
+Upon restarting the application, after a few seconds you will observe that the transaction has been restored, and the message has been successfully delivered to the ActiveMQ broker.
+
+----
+2023-10-13 15:21:36,458 INFO  [io.quarkus] (main) camel-quarkus-examples-message-bridge 3.5.0-SNAPSHOT on JVM (powered by Quarkus 3.5.0.CR1) started in 0.893s. Listening on: http://0.0.0.0:8080
+2023-10-13 15:21:36,459 INFO  [io.quarkus] (main) Profile prod activated.
+2023-10-13 15:21:36,459 INFO  [io.quarkus] (main) Installed features: [artemis-jms, camel-attachments, camel-core, camel-direct, camel-jms, camel-jta, camel-platform-http, camel-rest, cdi, messaginghub-pooled-jms, narayana-jta, smallrye-context-propagation, vertx]
+2023-10-13 15:21:46,386 INFO  [org.acm.mes.bri.DummyXAResourceRecovery] (Periodic Recovery) DummyXAResourceRecovery returning list of resources: [org.acme.message.bridge.DummyXAResource@3739f1f4, org.acme.message.bridge.DummyXAResource@7d2113fb]
+2023-10-13 15:21:46,391 WARN  [com.arj.ats.jta] (Periodic Recovery) ARJUNA016037: Could not find new XAResource to use for recovering non-serializable XAResource XAResourceRecord < resource:null, txid:< formatId=131077, gtrid_length=35, bqual_length=36, tx_uid=0:ffffc0a80136:8e8b:65294417:31, node_name=quarkus, branch_uid=0:ffffc0a80136:8e8b:65294417:33, subordinatenodename=null, eis_name=0 >, heuristic: TwoPhaseOutcome.FINISH_OK com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord@1d57754e >
+2023-10-13 15:21:46,483 INFO  [org.acm.mes.bri.DummyXAResourceRecovery] (Periodic Recovery) DummyXAResourceRecovery returning list of resources: [org.acme.message.bridge.DummyXAResource@24a51dd0, org.acme.message.bridge.DummyXAResource@4fc1b14d]
+2023-10-13 15:21:46,484 WARN  [com.arj.ats.jta] (Periodic Recovery) ARJUNA016038: No XAResource to recover < formatId=131077, gtrid_length=35, bqual_length=36, tx_uid=0:ffffc0a80136:8e8b:65294417:31, node_name=quarkus, branch_uid=0:ffffc0a80136:8e8b:65294417:33, subordinatenodename=null, eis_name=0 >
+2023-10-13 15:21:46,485 INFO  [org.acm.mes.bri.DummyXAResource] (Periodic Recovery) Committing DummyXAResource
+2023-10-13 15:21:46,512 INFO  [amq] (Camel (camel-1) thread #2 - JmsConsumer[in]) ActiveMQ received: crash
+----
+
+You may observe the warning messages related to the XAResource recovery in the logs. This is a known issue related to how we simulate the crash of the system and can be ignored.
+
+=== 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]
+
+==== JVM mode
+
+[source,shell]
+----
+$ mvn clean package
+$ java -jar target/quarkus-app/quarkus-run.jar
+...
+[io.quarkus] (main) camel-quarkus-examples-... started in 1.163s.
+----
+
+=== Running on OpenShift
+
+You can also deploy this example as an OpenShift pod using the capabilities of the quarkus-maven-plugin.
+
+Before doing so, make sure to deploy the AMQ and IBMMQ brokers:
+
+----
+oc new-app quay.io/artemiscloud/activemq-artemis-broker -e AMQ_USER=admin -e AMQ_PASSWORD=admin
+oc patch service/activemq-artemis-broker -p '{"spec":{"ports":[{"name":"61616-tcp", "port": 61616, "protocol": "TCP", "targetPort": 61616}]}}'
+----
+
+----
+oc new-app icr.io/ibm-messaging/mq:9.3.2.1-r1 -e MQ_QMGR_NAME=QM1 -e LICENSE=accept -e MQ_APP_PASSWORD=passw0rd
+----
+
+Next, create a `PersistentVolumeClaim` to serve as the storage for the transaction manager's object store. This example assumes that a persistent volume claim named `message-bridge` has already been set up. Keep in mind that the configuration of the persistent volume may require adjustments based on your specific OpenShift setup:
+
+----
+oc create -f - <<EOF
+kind: PersistentVolumeClaim
+apiVersion: v1
+metadata:
+  name: message-bridge
+spec:
+  accessModes:
+    - ReadWriteOnce
+  resources:
+    requests:
+      storage: 1Gi
+EOF
+----
+
+Then deploy this example using the `openshift` profile specified within this project:
+
+----
+mvn clean package -DskipTests -Popenshift
+----
+
+Once the pod is up and running successfully, you can send messages in a manner similar to local deployment:
+
+----
+curl -X POST -H "Content-Type: text/plain" http://$(oc get route camel-quarkus-examples-message-bridge -o jsonpath='{.spec.host}')/message -d 'Hello world'
+----
+
+=== Running the tests
+
+This example comes with a couple of integration tests that verify the correct functionality. Before running the tests examine the IBM MQ license with:
+
+----

Review Comment:
   ok, and the tests execute well on ci.



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng commented on PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#issuecomment-1757187069

   Thanke @avano and I just add my comments. The other thing is that license header is missing in some files. Please check them!


-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1360733267


##########
message-bridge/src/test/java/org/acme/message/bridge/MessageBridgeITCase.java:
##########
@@ -0,0 +1,101 @@
+/*
+ * 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.
+ */
+package org.acme.message.bridge;
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.concurrent.TimeUnit;
+
+import io.quarkus.artemis.test.ArtemisTestResource;
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+import io.restassured.RestAssured;
+import org.acme.message.bridge.resource.IBMMQTestResource;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.awaitility.Awaitility;
+import org.eclipse.microprofile.config.ConfigProvider;
+import org.junit.jupiter.api.MethodOrderer;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestMethodOrder;
+import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+@QuarkusIntegrationTest
+@QuarkusTestResource(ArtemisTestResource.class)
+@QuarkusTestResource(IBMMQTestResource.class)
+@EnabledIfSystemProperty(named = "ibm.mq.container.license", matches = "accept")
+// The crash test will kill the app, so it must be executed last as there is no way to restart the application

Review Comment:
   Nice comment, really helpful :+1:



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "avano (via GitHub)" <gi...@apache.org>.
avano commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1361827704


##########
message-bridge/README.adoc:
##########
@@ -0,0 +1,206 @@
+= Message Bridge: A Camel Quarkus example
+:cq-example-description: An example that shows how to configure AMQ and IBM MQ clients to use the connection pooling and XA transactions.
+
+{cq-description}
+
+TIP: Check the https://camel.apache.org/camel-quarkus/latest/first-steps.html[Camel Quarkus User guide] for prerequisites
+and other general information.
+
+== Overview
+
+In this example, a basic REST endpoint is provided for users to dispatch a message to the IBM MQ queue. Subsequently, all messages from the IBM MQ are relayed to an ActiveMQ queue within an XA transaction. To showcase the transaction functionality, a message containing the keyword "rollback" will initiate a transaction rollback. To demonstrate the process of a transaction recovery after a crash, send a message with they keyword "crash".
+
+Details regarding client configurations can be located in the `src/main/resources/application.properties` file.
+
+== Prerequisites
+
+First start the ActiveMQ broker:
+----
+docker run \
+  -d \
+  -e AMQ_USER=admin \
+  -e AMQ_PASSWORD=admin \
+  -p 61616:61616 \
+  quay.io/artemiscloud/activemq-artemis-broker
+----
+
+Then start the IBM MQ broker:
+----
+docker run \
+  -d \
+  -e LICENSE=accept \
+  -e MQ_QMGR_NAME=QM1 \
+  -e MQ_APP_PASSWORD=passw0rd \
+  -p 1414:1414 \
+  icr.io/ibm-messaging/mq:9.3.2.1-r1
+----
+
+== 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.
+
+After the application is started, you can send messages to the IBMMQ queue using the rest endpoint `/message`:
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello World'
+----
+
+In the application logs you will see:
+
+----
+2023-10-11 08:10:52,782 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello World
+2023-10-11 08:10:52,903 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello World
+2023-10-11 08:10:52,927 INFO  [amq] (Camel (camel-4) thread #8 - JmsConsumer[in]) ActiveMQ received: Hello World
+----
+
+The message is initially dispatched to an IBMMQ queue, then relayed to an ActiveMQ queue, and ultimately retrieved from the ActiveMQ queue and printed to the log without any issues.
+
+=== Transaction rollback
+
+If you wish to illustrate a rollback, simply send a message containing the `rollback` keyword.
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello rollback'
+----
+The log could be divided into two segments. In this demonstration, the IBMMQ to ActiveMQ route is configured to simulate a transaction rollback following the dispatch of a message to the ActiveMQ queue. Due to the rollback, you'll notice that the message isn't fetched from the ActiveMQ queue and isn't logged:
+
+----
+2023-10-11 08:12:46,314 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello rollback
+2023-10-11 08:12:46,453 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello rollback
+2023-10-11 08:12:46,457 WARN  [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Transaction rollback (0xea2b886) redelivered(false) for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003) caught: Simulated rollback
+2023-10-11 08:12:46,458 ERROR [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Failed delivery for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003). Exhausted after delivery attempt: 1 caught: java.lang.RuntimeException: Simulated rollback
+...
+<truncated exception from the simulated rollback>
+----
+
+Because the transaction was rolled back, the message wasn't successfully processed and it is returned to the IBMMQ queue and subsequently redelivered. In this instance, the delivery is successful and logged accordingly:
+
+----
+2023-10-11 08:12:46,561 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Redelivering message after rollback to ActiveMQ: Hello rollback
+2023-10-11 08:12:46,567 INFO  [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Transaction commit (0xea2b886) redelivered(true) for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000004))
+2023-10-11 08:12:46,585 INFO  [amq] (Camel (camel-4) thread #8 - JmsConsumer[in]) ActiveMQ received: Hello rollback
+----
+
+In this example, a local file transaction storage is used, which is set up through the `quarkus.transaction-manager.object-store.directory` property. If you prefer to utilize a database for configuring the storage, please refer to the Quarkus transactions guide available at https://quarkus.io/guides/transaction#jdbcstore.
+
+=== Transaction recovery
+
+To trigger a JVM crash during the transaction, send a message containing the word `crash`.
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello crash'
+----
+
+This will result in the JVM stopping abruptly:
+
+----
+2023-10-13 15:21:03,277 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: crash
+2023-10-13 15:21:03,429 INFO  [ibmmq-amq] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: crash
+2023-10-13 15:21:03,449 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Preparing DummyXAResource
+2023-10-13 15:21:03,461 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Committing DummyXAResource
+2023-10-13 15:21:03,461 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Crashing the system
+----
+
+Upon restarting the application, after a few seconds you will observe that the transaction has been restored, and the message has been successfully delivered to the ActiveMQ broker.
+
+----
+2023-10-13 15:21:36,458 INFO  [io.quarkus] (main) camel-quarkus-examples-message-bridge 3.5.0-SNAPSHOT on JVM (powered by Quarkus 3.5.0.CR1) started in 0.893s. Listening on: http://0.0.0.0:8080
+2023-10-13 15:21:36,459 INFO  [io.quarkus] (main) Profile prod activated.
+2023-10-13 15:21:36,459 INFO  [io.quarkus] (main) Installed features: [artemis-jms, camel-attachments, camel-core, camel-direct, camel-jms, camel-jta, camel-platform-http, camel-rest, cdi, messaginghub-pooled-jms, narayana-jta, smallrye-context-propagation, vertx]
+2023-10-13 15:21:46,386 INFO  [org.acm.mes.bri.DummyXAResourceRecovery] (Periodic Recovery) DummyXAResourceRecovery returning list of resources: [org.acme.message.bridge.DummyXAResource@3739f1f4, org.acme.message.bridge.DummyXAResource@7d2113fb]
+2023-10-13 15:21:46,391 WARN  [com.arj.ats.jta] (Periodic Recovery) ARJUNA016037: Could not find new XAResource to use for recovering non-serializable XAResource XAResourceRecord < resource:null, txid:< formatId=131077, gtrid_length=35, bqual_length=36, tx_uid=0:ffffc0a80136:8e8b:65294417:31, node_name=quarkus, branch_uid=0:ffffc0a80136:8e8b:65294417:33, subordinatenodename=null, eis_name=0 >, heuristic: TwoPhaseOutcome.FINISH_OK com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord@1d57754e >
+2023-10-13 15:21:46,483 INFO  [org.acm.mes.bri.DummyXAResourceRecovery] (Periodic Recovery) DummyXAResourceRecovery returning list of resources: [org.acme.message.bridge.DummyXAResource@24a51dd0, org.acme.message.bridge.DummyXAResource@4fc1b14d]
+2023-10-13 15:21:46,484 WARN  [com.arj.ats.jta] (Periodic Recovery) ARJUNA016038: No XAResource to recover < formatId=131077, gtrid_length=35, bqual_length=36, tx_uid=0:ffffc0a80136:8e8b:65294417:31, node_name=quarkus, branch_uid=0:ffffc0a80136:8e8b:65294417:33, subordinatenodename=null, eis_name=0 >
+2023-10-13 15:21:46,485 INFO  [org.acm.mes.bri.DummyXAResource] (Periodic Recovery) Committing DummyXAResource
+2023-10-13 15:21:46,512 INFO  [amq] (Camel (camel-1) thread #2 - JmsConsumer[in]) ActiveMQ received: crash
+----
+
+You may observe the warning messages related to the XAResource recovery in the logs. This is a known issue related to how we simulate the crash of the system and can be ignored.
+
+=== 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]
+
+==== JVM mode
+
+[source,shell]
+----
+$ mvn clean package
+$ java -jar target/quarkus-app/quarkus-run.jar
+...
+[io.quarkus] (main) camel-quarkus-examples-... started in 1.163s.
+----
+
+=== Running on OpenShift
+
+You can also deploy this example as an OpenShift pod using the capabilities of the quarkus-maven-plugin.
+
+Before doing so, make sure to deploy the AMQ and IBMMQ brokers:
+
+----
+oc new-app quay.io/artemiscloud/activemq-artemis-broker -e AMQ_USER=admin -e AMQ_PASSWORD=admin
+oc patch service/activemq-artemis-broker -p '{"spec":{"ports":[{"name":"61616-tcp", "port": 61616, "protocol": "TCP", "targetPort": 61616}]}}'
+----
+
+----
+oc new-app icr.io/ibm-messaging/mq:9.3.2.1-r1 -e MQ_QMGR_NAME=QM1 -e LICENSE=accept -e MQ_APP_PASSWORD=passw0rd
+----
+
+Next, create a `PersistentVolumeClaim` to serve as the storage for the transaction manager's object store. This example assumes that a persistent volume claim named `message-bridge` has already been set up. Keep in mind that the configuration of the persistent volume may require adjustments based on your specific OpenShift setup:
+
+----
+oc create -f - <<EOF
+kind: PersistentVolumeClaim
+apiVersion: v1
+metadata:
+  name: message-bridge
+spec:
+  accessModes:
+    - ReadWriteOnce
+  resources:
+    requests:
+      storage: 1Gi
+EOF
+----
+
+Then deploy this example using the `openshift` profile specified within this project:
+
+----
+mvn clean package -DskipTests -Popenshift
+----
+
+Once the pod is up and running successfully, you can send messages in a manner similar to local deployment:
+
+----
+curl -X POST -H "Content-Type: text/plain" http://$(oc get route camel-quarkus-examples-message-bridge -o jsonpath='{.spec.host}')/message -d 'Hello world'
+----
+
+=== Running the tests
+
+This example comes with a couple of integration tests that verify the correct functionality. Before running the tests examine the IBM MQ license with:
+
+----

Review Comment:
   I removed the section from readme and moved the property to the application.properties



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "avano (via GitHub)" <gi...@apache.org>.
avano commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1354779262


##########
message-bridge/README.adoc:
##########
@@ -0,0 +1,107 @@
+= Message Bridge: A Camel Quarkus example
+:cq-example-description: An example that shows how to configure AMQ and IBM MQ clients to use the connection pooling and XA transactions.
+
+{cq-description}
+
+TIP: Check the https://camel.apache.org/camel-quarkus/latest/first-steps.html[Camel Quarkus User guide] for prerequisites
+and other general information.
+
+== Overview
+
+In this example, a basic REST endpoint is provided for users to dispatch a message to the IBM MQ queue. Subsequently, all messages from the IBM MQ are relayed to an ActiveMQ queue within an XA transaction. To showcase the transaction functionality, a message containing the keyword "rollback" will initiate a transaction rollback.
+
+Details regarding client configurations can be located in the link:src/main/resources/application.properties file.
+
+== Prerequisites
+
+First start the ActiveMQ broker:
+----
+docker run \
+  -e AMQ_USER=admin -e AMQ_PASSWORD=admin \
+  -d -p 61616:61616 \
+  quay.io/artemiscloud/activemq-artemis-broker
+----
+
+Then start the IBM MQ broker:
+----
+docker run \
+  -e LICENSE=accept \
+  -e MQ_QMGR_NAME=QM1 \
+  -e MQ_APP_PASSWORD=passw0rd \
+  -p 1414:1414

Review Comment:
   thanks, you're right



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1354520438


##########
message-bridge/src/main/java/org/acme/message/bridge/MessageBridgeRoute.java:
##########
@@ -0,0 +1,46 @@
+package org.acme.message.bridge;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import org.apache.camel.builder.RouteBuilder;
+
+@ApplicationScoped
+public class MessageBridgeRoute extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+        restConfiguration().component("servlet");
+        rest()
+                .post("/message")
+                .id("rest")
+                .to("direct:publish");
+
+        from("direct:publish")
+                .id("ibmmq")
+                .transacted()
+                .log("Sending message to IBMMQ: ${body}")
+                .to("ibmmq:queue:{{ibm.mq.queue}}?disableReplyTo=true");
+
+        from("ibmmq:queue:{{ibm.mq.queue}}")
+                .id("ibmmq-amq")
+                .transacted()
+                .choice()
+                .when(simple("${header.JMSRedelivered}"))
+                .log("Redelivering message after rollback to ActiveMQ: ${body}")
+                .otherwise()
+                .log("Sending message from IBMMQ to ActiveMQ: ${body}")
+                .end()
+                .to("amq:queue:{{amq.queue}}")
+                .process(ex -> {
+                    if (ex.getIn().getBody(String.class).toLowerCase().contains("rollback")) {
+                        if (!ex.getIn().getHeader("JMSRedelivered", Boolean.class)) {

Review Comment:
   The idea might be to rollback the transaction only once. So that we see a rollback followed by successful commit. Maybe a comment could help readability.



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger merged PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165


-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1361682379


##########
message-bridge/README.adoc:
##########
@@ -0,0 +1,206 @@
+= Message Bridge: A Camel Quarkus example
+:cq-example-description: An example that shows how to configure AMQ and IBM MQ clients to use the connection pooling and XA transactions.
+
+{cq-description}
+
+TIP: Check the https://camel.apache.org/camel-quarkus/latest/first-steps.html[Camel Quarkus User guide] for prerequisites
+and other general information.
+
+== Overview
+
+In this example, a basic REST endpoint is provided for users to dispatch a message to the IBM MQ queue. Subsequently, all messages from the IBM MQ are relayed to an ActiveMQ queue within an XA transaction. To showcase the transaction functionality, a message containing the keyword "rollback" will initiate a transaction rollback. To demonstrate the process of a transaction recovery after a crash, send a message with they keyword "crash".
+
+Details regarding client configurations can be located in the `src/main/resources/application.properties` file.
+
+== Prerequisites
+
+First start the ActiveMQ broker:
+----
+docker run \
+  -d \
+  -e AMQ_USER=admin \
+  -e AMQ_PASSWORD=admin \
+  -p 61616:61616 \
+  quay.io/artemiscloud/activemq-artemis-broker
+----
+
+Then start the IBM MQ broker:
+----
+docker run \
+  -d \
+  -e LICENSE=accept \
+  -e MQ_QMGR_NAME=QM1 \
+  -e MQ_APP_PASSWORD=passw0rd \
+  -p 1414:1414 \
+  icr.io/ibm-messaging/mq:9.3.2.1-r1
+----
+
+== 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.
+
+After the application is started, you can send messages to the IBMMQ queue using the rest endpoint `/message`:
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello World'
+----
+
+In the application logs you will see:
+
+----
+2023-10-11 08:10:52,782 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello World
+2023-10-11 08:10:52,903 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello World
+2023-10-11 08:10:52,927 INFO  [amq] (Camel (camel-4) thread #8 - JmsConsumer[in]) ActiveMQ received: Hello World
+----
+
+The message is initially dispatched to an IBMMQ queue, then relayed to an ActiveMQ queue, and ultimately retrieved from the ActiveMQ queue and printed to the log without any issues.
+
+=== Transaction rollback
+
+If you wish to illustrate a rollback, simply send a message containing the `rollback` keyword.
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello rollback'
+----
+The log could be divided into two segments. In this demonstration, the IBMMQ to ActiveMQ route is configured to simulate a transaction rollback following the dispatch of a message to the ActiveMQ queue. Due to the rollback, you'll notice that the message isn't fetched from the ActiveMQ queue and isn't logged:
+
+----
+2023-10-11 08:12:46,314 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello rollback
+2023-10-11 08:12:46,453 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello rollback
+2023-10-11 08:12:46,457 WARN  [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Transaction rollback (0xea2b886) redelivered(false) for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003) caught: Simulated rollback
+2023-10-11 08:12:46,458 ERROR [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Failed delivery for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003). Exhausted after delivery attempt: 1 caught: java.lang.RuntimeException: Simulated rollback
+...
+<truncated exception from the simulated rollback>
+----
+
+Because the transaction was rolled back, the message wasn't successfully processed and it is returned to the IBMMQ queue and subsequently redelivered. In this instance, the delivery is successful and logged accordingly:
+
+----
+2023-10-11 08:12:46,561 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Redelivering message after rollback to ActiveMQ: Hello rollback
+2023-10-11 08:12:46,567 INFO  [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Transaction commit (0xea2b886) redelivered(true) for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000004))
+2023-10-11 08:12:46,585 INFO  [amq] (Camel (camel-4) thread #8 - JmsConsumer[in]) ActiveMQ received: Hello rollback
+----
+
+In this example, a local file transaction storage is used, which is set up through the `quarkus.transaction-manager.object-store.directory` property. If you prefer to utilize a database for configuring the storage, please refer to the Quarkus transactions guide available at https://quarkus.io/guides/transaction#jdbcstore.
+
+=== Transaction recovery
+
+To trigger a JVM crash during the transaction, send a message containing the word `crash`.
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello crash'
+----
+
+This will result in the JVM stopping abruptly:
+
+----
+2023-10-13 15:21:03,277 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: crash
+2023-10-13 15:21:03,429 INFO  [ibmmq-amq] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: crash
+2023-10-13 15:21:03,449 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Preparing DummyXAResource
+2023-10-13 15:21:03,461 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Committing DummyXAResource
+2023-10-13 15:21:03,461 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Crashing the system
+----
+
+Upon restarting the application, after a few seconds you will observe that the transaction has been restored, and the message has been successfully delivered to the ActiveMQ broker.
+
+----
+2023-10-13 15:21:36,458 INFO  [io.quarkus] (main) camel-quarkus-examples-message-bridge 3.5.0-SNAPSHOT on JVM (powered by Quarkus 3.5.0.CR1) started in 0.893s. Listening on: http://0.0.0.0:8080
+2023-10-13 15:21:36,459 INFO  [io.quarkus] (main) Profile prod activated.
+2023-10-13 15:21:36,459 INFO  [io.quarkus] (main) Installed features: [artemis-jms, camel-attachments, camel-core, camel-direct, camel-jms, camel-jta, camel-platform-http, camel-rest, cdi, messaginghub-pooled-jms, narayana-jta, smallrye-context-propagation, vertx]
+2023-10-13 15:21:46,386 INFO  [org.acm.mes.bri.DummyXAResourceRecovery] (Periodic Recovery) DummyXAResourceRecovery returning list of resources: [org.acme.message.bridge.DummyXAResource@3739f1f4, org.acme.message.bridge.DummyXAResource@7d2113fb]
+2023-10-13 15:21:46,391 WARN  [com.arj.ats.jta] (Periodic Recovery) ARJUNA016037: Could not find new XAResource to use for recovering non-serializable XAResource XAResourceRecord < resource:null, txid:< formatId=131077, gtrid_length=35, bqual_length=36, tx_uid=0:ffffc0a80136:8e8b:65294417:31, node_name=quarkus, branch_uid=0:ffffc0a80136:8e8b:65294417:33, subordinatenodename=null, eis_name=0 >, heuristic: TwoPhaseOutcome.FINISH_OK com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord@1d57754e >
+2023-10-13 15:21:46,483 INFO  [org.acm.mes.bri.DummyXAResourceRecovery] (Periodic Recovery) DummyXAResourceRecovery returning list of resources: [org.acme.message.bridge.DummyXAResource@24a51dd0, org.acme.message.bridge.DummyXAResource@4fc1b14d]
+2023-10-13 15:21:46,484 WARN  [com.arj.ats.jta] (Periodic Recovery) ARJUNA016038: No XAResource to recover < formatId=131077, gtrid_length=35, bqual_length=36, tx_uid=0:ffffc0a80136:8e8b:65294417:31, node_name=quarkus, branch_uid=0:ffffc0a80136:8e8b:65294417:33, subordinatenodename=null, eis_name=0 >
+2023-10-13 15:21:46,485 INFO  [org.acm.mes.bri.DummyXAResource] (Periodic Recovery) Committing DummyXAResource
+2023-10-13 15:21:46,512 INFO  [amq] (Camel (camel-1) thread #2 - JmsConsumer[in]) ActiveMQ received: crash
+----
+
+You may observe the warning messages related to the XAResource recovery in the logs. This is a known issue related to how we simulate the crash of the system and can be ignored.
+
+=== 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]
+
+==== JVM mode
+
+[source,shell]
+----
+$ mvn clean package
+$ java -jar target/quarkus-app/quarkus-run.jar
+...
+[io.quarkus] (main) camel-quarkus-examples-... started in 1.163s.
+----
+
+=== Running on OpenShift
+
+You can also deploy this example as an OpenShift pod using the capabilities of the quarkus-maven-plugin.
+
+Before doing so, make sure to deploy the AMQ and IBMMQ brokers:
+
+----
+oc new-app quay.io/artemiscloud/activemq-artemis-broker -e AMQ_USER=admin -e AMQ_PASSWORD=admin
+oc patch service/activemq-artemis-broker -p '{"spec":{"ports":[{"name":"61616-tcp", "port": 61616, "protocol": "TCP", "targetPort": 61616}]}}'
+----
+
+----
+oc new-app icr.io/ibm-messaging/mq:9.3.2.1-r1 -e MQ_QMGR_NAME=QM1 -e LICENSE=accept -e MQ_APP_PASSWORD=passw0rd
+----
+
+Next, create a `PersistentVolumeClaim` to serve as the storage for the transaction manager's object store. This example assumes that a persistent volume claim named `message-bridge` has already been set up. Keep in mind that the configuration of the persistent volume may require adjustments based on your specific OpenShift setup:
+
+----
+oc create -f - <<EOF
+kind: PersistentVolumeClaim
+apiVersion: v1
+metadata:
+  name: message-bridge
+spec:
+  accessModes:
+    - ReadWriteOnce
+  resources:
+    requests:
+      storage: 1Gi
+EOF
+----
+
+Then deploy this example using the `openshift` profile specified within this project:
+
+----
+mvn clean package -DskipTests -Popenshift
+----
+
+Once the pod is up and running successfully, you can send messages in a manner similar to local deployment:
+
+----
+curl -X POST -H "Content-Type: text/plain" http://$(oc get route camel-quarkus-examples-message-bridge -o jsonpath='{.spec.host}')/message -d 'Hello world'
+----
+
+=== Running the tests
+
+This example comes with a couple of integration tests that verify the correct functionality. Before running the tests examine the IBM MQ license with:
+
+----

Review Comment:
   Many thanks for sharing, it's understood now :+1: 
   
   Thinking a bit more about the value of integration tests in examples. They actually prevent regressions, as we run the itests at each release when we [upgrade and tag examples](https://camel.apache.org/camel-quarkus/3.4.x/contributor-guide/release-guide.html#_upgrade_and_tag_examples). So, the rationale would be that it's not really up to the example user to read the license but more the developer that commit the code. We have kind of similar mechanism like [that](https://github.com/apache/camel-quarkus/blob/main/integration-test-groups/jdbc/mssql/src/test/resources/container-license-acceptance.txt).
   
   In this case, shouldn't we remove the test section from the README ? And then set the `LICENSE=accept` environment variable in the test config to show that the developers accept the license in the context of itests ?



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "avano (via GitHub)" <gi...@apache.org>.
avano commented on PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#issuecomment-1761126866

   > Please can we add the `native` profile into `pom.xml` (I assume all of this stuff has native support?).
   > 
   > Also, as we're using Docker, can we add a profile to skip tests on Windows. Like [this](https://github.com/apache/camel-quarkus-examples/blob/main/cluster-leader-election/pom.xml?rgh-link-date=2023-10-13T08%3A10%3A46Z#L340-L350).
   
   for the ibm mq client, there is an [open issue](https://github.com/apache/camel-quarkus/issues/4924) about native, that's why I didn't include it


-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "avano (via GitHub)" <gi...@apache.org>.
avano commented on PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#issuecomment-1757107506

   @zhfeng can you review pls?
   @aldettinger fyi


-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1354481430


##########
message-bridge/src/main/resources/application.properties:
##########
@@ -0,0 +1,34 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+ibm.mq.host=localhost
+ibm.mq.port=1414
+ibm.mq.channel=DEV.APP.SVRCONN
+ibm.mq.queueManagerName=QM1
+ibm.mq.user=app
+ibm.mq.password=passw0rd
+ibm.mq.queue=DEV.QUEUE.1
+
+quarkus.artemis.amqConnectionFactory.url=tcp://localhost:61616
+quarkus.artemis.amqConnectionFactory.username=admin
+quarkus.artemis.amqConnectionFactory.password=admin
+amq.queue=in
+
+quarkus.camel.servlet.url-patterns=/*
+
+quarkus.pooled-jms.transaction=xa
+quarkus.pooled-jms.pooling.enabled=true
+quarkus.pooled-jms.max-connections=8

Review Comment:
   I'd like to add `quarkus.transaction-manager.enable-recovery=true` and it could be helpful to test the crash crash secenario.



##########
message-bridge/eclipse-formatter-config.xml:
##########


Review Comment:
   Why we need this file? I think it is related to Eclipse IDE?



##########
message-bridge/src/main/java/org/acme/message/bridge/MessageBridgeRoute.java:
##########
@@ -0,0 +1,46 @@
+package org.acme.message.bridge;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import org.apache.camel.builder.RouteBuilder;
+
+@ApplicationScoped
+public class MessageBridgeRoute extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+        restConfiguration().component("servlet");
+        rest()
+                .post("/message")
+                .id("rest")
+                .to("direct:publish");
+
+        from("direct:publish")
+                .id("ibmmq")
+                .transacted()
+                .log("Sending message to IBMMQ: ${body}")
+                .to("ibmmq:queue:{{ibm.mq.queue}}?disableReplyTo=true");
+
+        from("ibmmq:queue:{{ibm.mq.queue}}")
+                .id("ibmmq-amq")
+                .transacted()
+                .choice()
+                .when(simple("${header.JMSRedelivered}"))
+                .log("Redelivering message after rollback to ActiveMQ: ${body}")
+                .otherwise()
+                .log("Sending message from IBMMQ to ActiveMQ: ${body}")
+                .end()
+                .to("amq:queue:{{amq.queue}}")
+                .process(ex -> {
+                    if (ex.getIn().getBody(String.class).toLowerCase().contains("rollback")) {
+                        if (!ex.getIn().getHeader("JMSRedelivered", Boolean.class)) {

Review Comment:
   Why we check `JMSRedelivered` here?



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "avano (via GitHub)" <gi...@apache.org>.
avano commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1361561619


##########
message-bridge/README.adoc:
##########
@@ -0,0 +1,206 @@
+= Message Bridge: A Camel Quarkus example
+:cq-example-description: An example that shows how to configure AMQ and IBM MQ clients to use the connection pooling and XA transactions.
+
+{cq-description}
+
+TIP: Check the https://camel.apache.org/camel-quarkus/latest/first-steps.html[Camel Quarkus User guide] for prerequisites
+and other general information.
+
+== Overview
+
+In this example, a basic REST endpoint is provided for users to dispatch a message to the IBM MQ queue. Subsequently, all messages from the IBM MQ are relayed to an ActiveMQ queue within an XA transaction. To showcase the transaction functionality, a message containing the keyword "rollback" will initiate a transaction rollback. To demonstrate the process of a transaction recovery after a crash, send a message with they keyword "crash".
+
+Details regarding client configurations can be located in the `src/main/resources/application.properties` file.
+
+== Prerequisites
+
+First start the ActiveMQ broker:
+----
+docker run \
+  -d \
+  -e AMQ_USER=admin \
+  -e AMQ_PASSWORD=admin \
+  -p 61616:61616 \
+  quay.io/artemiscloud/activemq-artemis-broker
+----
+
+Then start the IBM MQ broker:
+----
+docker run \
+  -d \
+  -e LICENSE=accept \
+  -e MQ_QMGR_NAME=QM1 \
+  -e MQ_APP_PASSWORD=passw0rd \
+  -p 1414:1414 \
+  icr.io/ibm-messaging/mq:9.3.2.1-r1
+----
+
+== 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.
+
+After the application is started, you can send messages to the IBMMQ queue using the rest endpoint `/message`:
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello World'
+----
+
+In the application logs you will see:
+
+----
+2023-10-11 08:10:52,782 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello World
+2023-10-11 08:10:52,903 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello World
+2023-10-11 08:10:52,927 INFO  [amq] (Camel (camel-4) thread #8 - JmsConsumer[in]) ActiveMQ received: Hello World
+----
+
+The message is initially dispatched to an IBMMQ queue, then relayed to an ActiveMQ queue, and ultimately retrieved from the ActiveMQ queue and printed to the log without any issues.
+
+=== Transaction rollback
+
+If you wish to illustrate a rollback, simply send a message containing the `rollback` keyword.
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello rollback'
+----
+The log could be divided into two segments. In this demonstration, the IBMMQ to ActiveMQ route is configured to simulate a transaction rollback following the dispatch of a message to the ActiveMQ queue. Due to the rollback, you'll notice that the message isn't fetched from the ActiveMQ queue and isn't logged:
+
+----
+2023-10-11 08:12:46,314 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello rollback
+2023-10-11 08:12:46,453 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello rollback
+2023-10-11 08:12:46,457 WARN  [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Transaction rollback (0xea2b886) redelivered(false) for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003) caught: Simulated rollback
+2023-10-11 08:12:46,458 ERROR [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Failed delivery for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003). Exhausted after delivery attempt: 1 caught: java.lang.RuntimeException: Simulated rollback
+...
+<truncated exception from the simulated rollback>
+----
+
+Because the transaction was rolled back, the message wasn't successfully processed and it is returned to the IBMMQ queue and subsequently redelivered. In this instance, the delivery is successful and logged accordingly:
+
+----
+2023-10-11 08:12:46,561 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Redelivering message after rollback to ActiveMQ: Hello rollback
+2023-10-11 08:12:46,567 INFO  [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Transaction commit (0xea2b886) redelivered(true) for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000004))
+2023-10-11 08:12:46,585 INFO  [amq] (Camel (camel-4) thread #8 - JmsConsumer[in]) ActiveMQ received: Hello rollback
+----
+
+In this example, a local file transaction storage is used, which is set up through the `quarkus.transaction-manager.object-store.directory` property. If you prefer to utilize a database for configuring the storage, please refer to the Quarkus transactions guide available at https://quarkus.io/guides/transaction#jdbcstore.
+
+=== Transaction recovery
+
+To trigger a JVM crash during the transaction, send a message containing the word `crash`.
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello crash'
+----
+
+This will result in the JVM stopping abruptly:
+
+----
+2023-10-13 15:21:03,277 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: crash
+2023-10-13 15:21:03,429 INFO  [ibmmq-amq] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: crash
+2023-10-13 15:21:03,449 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Preparing DummyXAResource
+2023-10-13 15:21:03,461 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Committing DummyXAResource
+2023-10-13 15:21:03,461 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Crashing the system
+----
+
+Upon restarting the application, after a few seconds you will observe that the transaction has been restored, and the message has been successfully delivered to the ActiveMQ broker.
+
+----
+2023-10-13 15:21:36,458 INFO  [io.quarkus] (main) camel-quarkus-examples-message-bridge 3.5.0-SNAPSHOT on JVM (powered by Quarkus 3.5.0.CR1) started in 0.893s. Listening on: http://0.0.0.0:8080
+2023-10-13 15:21:36,459 INFO  [io.quarkus] (main) Profile prod activated.
+2023-10-13 15:21:36,459 INFO  [io.quarkus] (main) Installed features: [artemis-jms, camel-attachments, camel-core, camel-direct, camel-jms, camel-jta, camel-platform-http, camel-rest, cdi, messaginghub-pooled-jms, narayana-jta, smallrye-context-propagation, vertx]
+2023-10-13 15:21:46,386 INFO  [org.acm.mes.bri.DummyXAResourceRecovery] (Periodic Recovery) DummyXAResourceRecovery returning list of resources: [org.acme.message.bridge.DummyXAResource@3739f1f4, org.acme.message.bridge.DummyXAResource@7d2113fb]
+2023-10-13 15:21:46,391 WARN  [com.arj.ats.jta] (Periodic Recovery) ARJUNA016037: Could not find new XAResource to use for recovering non-serializable XAResource XAResourceRecord < resource:null, txid:< formatId=131077, gtrid_length=35, bqual_length=36, tx_uid=0:ffffc0a80136:8e8b:65294417:31, node_name=quarkus, branch_uid=0:ffffc0a80136:8e8b:65294417:33, subordinatenodename=null, eis_name=0 >, heuristic: TwoPhaseOutcome.FINISH_OK com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord@1d57754e >
+2023-10-13 15:21:46,483 INFO  [org.acm.mes.bri.DummyXAResourceRecovery] (Periodic Recovery) DummyXAResourceRecovery returning list of resources: [org.acme.message.bridge.DummyXAResource@24a51dd0, org.acme.message.bridge.DummyXAResource@4fc1b14d]
+2023-10-13 15:21:46,484 WARN  [com.arj.ats.jta] (Periodic Recovery) ARJUNA016038: No XAResource to recover < formatId=131077, gtrid_length=35, bqual_length=36, tx_uid=0:ffffc0a80136:8e8b:65294417:31, node_name=quarkus, branch_uid=0:ffffc0a80136:8e8b:65294417:33, subordinatenodename=null, eis_name=0 >
+2023-10-13 15:21:46,485 INFO  [org.acm.mes.bri.DummyXAResource] (Periodic Recovery) Committing DummyXAResource
+2023-10-13 15:21:46,512 INFO  [amq] (Camel (camel-1) thread #2 - JmsConsumer[in]) ActiveMQ received: crash
+----
+
+You may observe the warning messages related to the XAResource recovery in the logs. This is a known issue related to how we simulate the crash of the system and can be ignored.
+
+=== 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]
+
+==== JVM mode
+
+[source,shell]
+----
+$ mvn clean package
+$ java -jar target/quarkus-app/quarkus-run.jar
+...
+[io.quarkus] (main) camel-quarkus-examples-... started in 1.163s.
+----
+
+=== Running on OpenShift
+
+You can also deploy this example as an OpenShift pod using the capabilities of the quarkus-maven-plugin.
+
+Before doing so, make sure to deploy the AMQ and IBMMQ brokers:
+
+----
+oc new-app quay.io/artemiscloud/activemq-artemis-broker -e AMQ_USER=admin -e AMQ_PASSWORD=admin
+oc patch service/activemq-artemis-broker -p '{"spec":{"ports":[{"name":"61616-tcp", "port": 61616, "protocol": "TCP", "targetPort": 61616}]}}'
+----
+
+----
+oc new-app icr.io/ibm-messaging/mq:9.3.2.1-r1 -e MQ_QMGR_NAME=QM1 -e LICENSE=accept -e MQ_APP_PASSWORD=passw0rd
+----
+
+Next, create a `PersistentVolumeClaim` to serve as the storage for the transaction manager's object store. This example assumes that a persistent volume claim named `message-bridge` has already been set up. Keep in mind that the configuration of the persistent volume may require adjustments based on your specific OpenShift setup:
+
+----
+oc create -f - <<EOF
+kind: PersistentVolumeClaim
+apiVersion: v1
+metadata:
+  name: message-bridge
+spec:
+  accessModes:
+    - ReadWriteOnce
+  resources:
+    requests:
+      storage: 1Gi
+EOF
+----
+
+Then deploy this example using the `openshift` profile specified within this project:
+
+----
+mvn clean package -DskipTests -Popenshift
+----
+
+Once the pod is up and running successfully, you can send messages in a manner similar to local deployment:
+
+----
+curl -X POST -H "Content-Type: text/plain" http://$(oc get route camel-quarkus-examples-message-bridge -o jsonpath='{.spec.host}')/message -d 'Hello world'
+----
+
+=== Running the tests
+
+This example comes with a couple of integration tests that verify the correct functionality. Before running the tests examine the IBM MQ license with:
+
+----

Review Comment:
   technically it is not needed, but to run the ibm mq docker image, you need to accept the license. This only provides a way how to view the license in case you want to read it beforehand.
   
   running the docker container with `-e LICENSE=view` only prints the license and ends with `License not accepted` as you mentioned.
   
   this command comes from the container itself, e.g. if you run just `docker run icr.io/ibm-messaging/mq:9.3.2.1-r1` it ends with:
   
   ```
   2023-10-17T06:14:37.166Z Error: Set environment variable LICENSE=accept to indicate acceptance of license terms and conditions.
   2023-10-17T06:14:37.166Z License agreements and information can be viewed by setting the environment variable LICENSE=view.  You can also set the LANG environment variable to view the license in a different language.
   2023-10-17T06:14:37.166Z Error checking license acceptance: Set environment variable LICENSE=accept to indicate acceptance of license terms and conditions
   ```
   
   to run the tests, you need to use `-Dibm.mq.container.license=accept` and this value is passed to the docker image as the LICENSE env var [here](https://github.com/avano/camel-quarkus-examples/blob/ibmmq-amq/message-bridge/src/test/java/org/acme/message/bridge/resource/IBMMQTestResource.java#L40), otherwise if you don't accept the tests are [skipped](https://github.com/avano/camel-quarkus-examples/blob/ibmmq-amq/message-bridge/src/test/java/org/acme/message/bridge/MessageBridgeITCase.java#L43)



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1360710394


##########
message-bridge/README.adoc:
##########
@@ -0,0 +1,206 @@
+= Message Bridge: A Camel Quarkus example
+:cq-example-description: An example that shows how to configure AMQ and IBM MQ clients to use the connection pooling and XA transactions.
+
+{cq-description}
+
+TIP: Check the https://camel.apache.org/camel-quarkus/latest/first-steps.html[Camel Quarkus User guide] for prerequisites
+and other general information.
+
+== Overview
+
+In this example, a basic REST endpoint is provided for users to dispatch a message to the IBM MQ queue. Subsequently, all messages from the IBM MQ are relayed to an ActiveMQ queue within an XA transaction. To showcase the transaction functionality, a message containing the keyword "rollback" will initiate a transaction rollback. To demonstrate the process of a transaction recovery after a crash, send a message with they keyword "crash".
+
+Details regarding client configurations can be located in the `src/main/resources/application.properties` file.
+
+== Prerequisites
+
+First start the ActiveMQ broker:
+----
+docker run \
+  -d \
+  -e AMQ_USER=admin \
+  -e AMQ_PASSWORD=admin \
+  -p 61616:61616 \
+  quay.io/artemiscloud/activemq-artemis-broker
+----
+
+Then start the IBM MQ broker:
+----
+docker run \
+  -d \
+  -e LICENSE=accept \
+  -e MQ_QMGR_NAME=QM1 \
+  -e MQ_APP_PASSWORD=passw0rd \
+  -p 1414:1414 \
+  icr.io/ibm-messaging/mq:9.3.2.1-r1
+----
+
+== 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.
+
+After the application is started, you can send messages to the IBMMQ queue using the rest endpoint `/message`:
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello World'
+----
+
+In the application logs you will see:
+
+----
+2023-10-11 08:10:52,782 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello World
+2023-10-11 08:10:52,903 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello World
+2023-10-11 08:10:52,927 INFO  [amq] (Camel (camel-4) thread #8 - JmsConsumer[in]) ActiveMQ received: Hello World
+----
+
+The message is initially dispatched to an IBMMQ queue, then relayed to an ActiveMQ queue, and ultimately retrieved from the ActiveMQ queue and printed to the log without any issues.
+
+=== Transaction rollback
+
+If you wish to illustrate a rollback, simply send a message containing the `rollback` keyword.
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello rollback'
+----
+The log could be divided into two segments. In this demonstration, the IBMMQ to ActiveMQ route is configured to simulate a transaction rollback following the dispatch of a message to the ActiveMQ queue. Due to the rollback, you'll notice that the message isn't fetched from the ActiveMQ queue and isn't logged:
+
+----
+2023-10-11 08:12:46,314 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello rollback
+2023-10-11 08:12:46,453 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello rollback
+2023-10-11 08:12:46,457 WARN  [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Transaction rollback (0xea2b886) redelivered(false) for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003) caught: Simulated rollback
+2023-10-11 08:12:46,458 ERROR [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Failed delivery for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003). Exhausted after delivery attempt: 1 caught: java.lang.RuntimeException: Simulated rollback
+...
+<truncated exception from the simulated rollback>
+----
+
+Because the transaction was rolled back, the message wasn't successfully processed and it is returned to the IBMMQ queue and subsequently redelivered. In this instance, the delivery is successful and logged accordingly:

Review Comment:
   nitpick, would rephrase `it is returned` into `it stays in the input broker`



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "avano (via GitHub)" <gi...@apache.org>.
avano commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1354577883


##########
message-bridge/src/main/resources/application.properties:
##########
@@ -0,0 +1,34 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+ibm.mq.host=localhost
+ibm.mq.port=1414
+ibm.mq.channel=DEV.APP.SVRCONN
+ibm.mq.queueManagerName=QM1
+ibm.mq.user=app
+ibm.mq.password=passw0rd
+ibm.mq.queue=DEV.QUEUE.1
+
+quarkus.artemis.amqConnectionFactory.url=tcp://localhost:61616
+quarkus.artemis.amqConnectionFactory.username=admin
+quarkus.artemis.amqConnectionFactory.password=admin
+amq.queue=in
+
+quarkus.camel.servlet.url-patterns=/*
+
+quarkus.pooled-jms.transaction=xa
+quarkus.pooled-jms.pooling.enabled=true
+quarkus.pooled-jms.max-connections=8

Review Comment:
   thanks, will check that out as well



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1354745002


##########
message-bridge/src/test/java/org/acme/message/bridge/MessageBridgeTest.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * 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.
+ */
+package org.acme.message.bridge;
+
+import io.quarkus.test.junit.QuarkusTest;
+import jakarta.inject.Inject;
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.AdviceWith;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.quarkus.test.CamelQuarkusTestSupport;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+@QuarkusTest
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
+public class MessageBridgeTest extends CamelQuarkusTestSupport {

Review Comment:
   Really awesome to have tests :+1: 
   
   Would it be even better to transform those tests ala integration test in another pr ? Maybe it would offer more coverage to detect regressions + it could also help on the path to test in native mode. Let's discuss.



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "avano (via GitHub)" <gi...@apache.org>.
avano commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1354781445


##########
message-bridge/src/test/java/org/acme/message/bridge/MessageBridgeTest.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * 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.
+ */
+package org.acme.message.bridge;
+
+import io.quarkus.test.junit.QuarkusTest;
+import jakarta.inject.Inject;
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.AdviceWith;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.quarkus.test.CamelQuarkusTestSupport;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+@QuarkusTest
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
+public class MessageBridgeTest extends CamelQuarkusTestSupport {

Review Comment:
   sure, I can rework in this PR as well, since there are changes needed anyways



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#issuecomment-1757564309

   > Good catch @aldettinger - For using transaction in clould environment, it would be good to use `jdbc-object-store` and will persist the transaction logs into the database. Please refer to https://quarkus.io/guides/transaction#jdbcstore
   
   Apparently from the quoted doc, it's possible to use persistent volume or database.
   So maybe, as a first step we could add a bit of doc in README ala:
   
   ```
   Under the hood, the distributed transaction is performed through XA[internet link to xa].
   As such, some transaction logs need to be persisted somewhere.
   In this example, the transaction logs are persisted in the folder named OjbectStore in the current directory.
   While deploying to kubernetes, one would need to use a persistent volume claim or to store the logs in a database[link to jdbc-object-store]
   ```


-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1360703688


##########
message-bridge/README.adoc:
##########
@@ -0,0 +1,206 @@
+= Message Bridge: A Camel Quarkus example
+:cq-example-description: An example that shows how to configure AMQ and IBM MQ clients to use the connection pooling and XA transactions.
+
+{cq-description}
+
+TIP: Check the https://camel.apache.org/camel-quarkus/latest/first-steps.html[Camel Quarkus User guide] for prerequisites
+and other general information.
+
+== Overview
+
+In this example, a basic REST endpoint is provided for users to dispatch a message to the IBM MQ queue. Subsequently, all messages from the IBM MQ are relayed to an ActiveMQ queue within an XA transaction. To showcase the transaction functionality, a message containing the keyword "rollback" will initiate a transaction rollback. To demonstrate the process of a transaction recovery after a crash, send a message with they keyword "crash".
+
+Details regarding client configurations can be located in the `src/main/resources/application.properties` file.
+
+== Prerequisites
+
+First start the ActiveMQ broker:
+----
+docker run \
+  -d \
+  -e AMQ_USER=admin \
+  -e AMQ_PASSWORD=admin \
+  -p 61616:61616 \
+  quay.io/artemiscloud/activemq-artemis-broker
+----
+
+Then start the IBM MQ broker:
+----
+docker run \
+  -d \
+  -e LICENSE=accept \
+  -e MQ_QMGR_NAME=QM1 \
+  -e MQ_APP_PASSWORD=passw0rd \
+  -p 1414:1414 \
+  icr.io/ibm-messaging/mq:9.3.2.1-r1
+----
+
+== 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.
+
+After the application is started, you can send messages to the IBMMQ queue using the rest endpoint `/message`:
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello World'
+----
+
+In the application logs you will see:
+
+----
+2023-10-11 08:10:52,782 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello World
+2023-10-11 08:10:52,903 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello World
+2023-10-11 08:10:52,927 INFO  [amq] (Camel (camel-4) thread #8 - JmsConsumer[in]) ActiveMQ received: Hello World
+----
+
+The message is initially dispatched to an IBMMQ queue, then relayed to an ActiveMQ queue, and ultimately retrieved from the ActiveMQ queue and printed to the log without any issues.
+
+=== Transaction rollback
+
+If you wish to illustrate a rollback, simply send a message containing the `rollback` keyword.
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello rollback'
+----
+The log could be divided into two segments. In this demonstration, the IBMMQ to ActiveMQ route is configured to simulate a transaction rollback following the dispatch of a message to the ActiveMQ queue. Due to the rollback, you'll notice that the message isn't fetched from the ActiveMQ queue and isn't logged:
+
+----
+2023-10-11 08:12:46,314 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello rollback
+2023-10-11 08:12:46,453 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello rollback
+2023-10-11 08:12:46,457 WARN  [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Transaction rollback (0xea2b886) redelivered(false) for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003) caught: Simulated rollback
+2023-10-11 08:12:46,458 ERROR [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Failed delivery for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003). Exhausted after delivery attempt: 1 caught: java.lang.RuntimeException: Simulated rollback
+...
+<truncated exception from the simulated rollback>
+----
+
+Because the transaction was rolled back, the message wasn't successfully processed and it is returned to the IBMMQ queue and subsequently redelivered. In this instance, the delivery is successful and logged accordingly:
+
+----
+2023-10-11 08:12:46,561 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Redelivering message after rollback to ActiveMQ: Hello rollback
+2023-10-11 08:12:46,567 INFO  [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Transaction commit (0xea2b886) redelivered(true) for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000004))
+2023-10-11 08:12:46,585 INFO  [amq] (Camel (camel-4) thread #8 - JmsConsumer[in]) ActiveMQ received: Hello rollback
+----
+
+In this example, a local file transaction storage is used, which is set up through the `quarkus.transaction-manager.object-store.directory` property. If you prefer to utilize a database for configuring the storage, please refer to the Quarkus transactions guide available at https://quarkus.io/guides/transaction#jdbcstore.
+
+=== Transaction recovery
+
+To trigger a JVM crash during the transaction, send a message containing the word `crash`.
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello crash'
+----
+
+This will result in the JVM stopping abruptly:
+
+----
+2023-10-13 15:21:03,277 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: crash
+2023-10-13 15:21:03,429 INFO  [ibmmq-amq] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: crash
+2023-10-13 15:21:03,449 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Preparing DummyXAResource
+2023-10-13 15:21:03,461 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Committing DummyXAResource
+2023-10-13 15:21:03,461 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Crashing the system
+----
+
+Upon restarting the application, after a few seconds you will observe that the transaction has been restored, and the message has been successfully delivered to the ActiveMQ broker.
+
+----
+2023-10-13 15:21:36,458 INFO  [io.quarkus] (main) camel-quarkus-examples-message-bridge 3.5.0-SNAPSHOT on JVM (powered by Quarkus 3.5.0.CR1) started in 0.893s. Listening on: http://0.0.0.0:8080
+2023-10-13 15:21:36,459 INFO  [io.quarkus] (main) Profile prod activated.
+2023-10-13 15:21:36,459 INFO  [io.quarkus] (main) Installed features: [artemis-jms, camel-attachments, camel-core, camel-direct, camel-jms, camel-jta, camel-platform-http, camel-rest, cdi, messaginghub-pooled-jms, narayana-jta, smallrye-context-propagation, vertx]
+2023-10-13 15:21:46,386 INFO  [org.acm.mes.bri.DummyXAResourceRecovery] (Periodic Recovery) DummyXAResourceRecovery returning list of resources: [org.acme.message.bridge.DummyXAResource@3739f1f4, org.acme.message.bridge.DummyXAResource@7d2113fb]
+2023-10-13 15:21:46,391 WARN  [com.arj.ats.jta] (Periodic Recovery) ARJUNA016037: Could not find new XAResource to use for recovering non-serializable XAResource XAResourceRecord < resource:null, txid:< formatId=131077, gtrid_length=35, bqual_length=36, tx_uid=0:ffffc0a80136:8e8b:65294417:31, node_name=quarkus, branch_uid=0:ffffc0a80136:8e8b:65294417:33, subordinatenodename=null, eis_name=0 >, heuristic: TwoPhaseOutcome.FINISH_OK com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord@1d57754e >
+2023-10-13 15:21:46,483 INFO  [org.acm.mes.bri.DummyXAResourceRecovery] (Periodic Recovery) DummyXAResourceRecovery returning list of resources: [org.acme.message.bridge.DummyXAResource@24a51dd0, org.acme.message.bridge.DummyXAResource@4fc1b14d]
+2023-10-13 15:21:46,484 WARN  [com.arj.ats.jta] (Periodic Recovery) ARJUNA016038: No XAResource to recover < formatId=131077, gtrid_length=35, bqual_length=36, tx_uid=0:ffffc0a80136:8e8b:65294417:31, node_name=quarkus, branch_uid=0:ffffc0a80136:8e8b:65294417:33, subordinatenodename=null, eis_name=0 >
+2023-10-13 15:21:46,485 INFO  [org.acm.mes.bri.DummyXAResource] (Periodic Recovery) Committing DummyXAResource
+2023-10-13 15:21:46,512 INFO  [amq] (Camel (camel-1) thread #2 - JmsConsumer[in]) ActiveMQ received: crash
+----
+
+You may observe the warning messages related to the XAResource recovery in the logs. This is a known issue related to how we simulate the crash of the system and can be ignored.
+
+=== 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]
+
+==== JVM mode
+
+[source,shell]
+----
+$ mvn clean package
+$ java -jar target/quarkus-app/quarkus-run.jar
+...
+[io.quarkus] (main) camel-quarkus-examples-... started in 1.163s.
+----
+
+=== Running on OpenShift
+
+You can also deploy this example as an OpenShift pod using the capabilities of the quarkus-maven-plugin.
+
+Before doing so, make sure to deploy the AMQ and IBMMQ brokers:
+
+----
+oc new-app quay.io/artemiscloud/activemq-artemis-broker -e AMQ_USER=admin -e AMQ_PASSWORD=admin
+oc patch service/activemq-artemis-broker -p '{"spec":{"ports":[{"name":"61616-tcp", "port": 61616, "protocol": "TCP", "targetPort": 61616}]}}'
+----
+
+----
+oc new-app icr.io/ibm-messaging/mq:9.3.2.1-r1 -e MQ_QMGR_NAME=QM1 -e LICENSE=accept -e MQ_APP_PASSWORD=passw0rd
+----
+
+Next, create a `PersistentVolumeClaim` to serve as the storage for the transaction manager's object store. This example assumes that a persistent volume claim named `message-bridge` has already been set up. Keep in mind that the configuration of the persistent volume may require adjustments based on your specific OpenShift setup:
+
+----
+oc create -f - <<EOF
+kind: PersistentVolumeClaim
+apiVersion: v1
+metadata:
+  name: message-bridge
+spec:
+  accessModes:
+    - ReadWriteOnce
+  resources:
+    requests:
+      storage: 1Gi
+EOF
+----
+
+Then deploy this example using the `openshift` profile specified within this project:
+
+----
+mvn clean package -DskipTests -Popenshift
+----
+
+Once the pod is up and running successfully, you can send messages in a manner similar to local deployment:
+
+----
+curl -X POST -H "Content-Type: text/plain" http://$(oc get route camel-quarkus-examples-message-bridge -o jsonpath='{.spec.host}')/message -d 'Hello world'
+----
+

Review Comment:
   Would be good to have a cleanup section, locally this worked for me:
   
   ```
   oc delete all --selector app=activemq-artemis-broker -o name
   oc delete all --selector app=mq -o name
   oc delete all --selector app.kubernetes.io/name=camel-quarkus-examples-message-bridge
   oc delete pvc message-bridge
   ```



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "avano (via GitHub)" <gi...@apache.org>.
avano commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1354577209


##########
message-bridge/eclipse-formatter-config.xml:
##########


Review Comment:
   it is used in the formatter plugin [here](https://github.com/avano/camel-quarkus-examples/blob/ibmmq-amq/message-bridge/pom.xml#L140). it seems to be present in every example, so I included it here as well



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng commented on PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#issuecomment-1757548822

   Good catch @aldettinger - For using transaction in clould environment, it would be good to use `jdbc-object-store` and will persist the transaction logs into the database. Please refer to https://quarkus.io/guides/transaction#jdbcstore


-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#issuecomment-1757207771

   You'll need to add a new entry into `docs/modules/ROOT/attachments/examples.json`.


-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1354859279


##########
message-bridge/src/main/java/org/acme/message/bridge/Producers.java:
##########
@@ -0,0 +1,83 @@
+package org.acme.message.bridge;
+
+import com.ibm.mq.jakarta.jms.MQXAConnectionFactory;
+import com.ibm.msg.client.jakarta.wmq.WMQConstants;
+import io.quarkiverse.messaginghub.pooled.jms.PooledJmsWrapper;
+import io.smallrye.common.annotation.Identifier;
+import jakarta.enterprise.inject.Default;
+import jakarta.jms.ConnectionFactory;
+import jakarta.jms.JMSException;
+import jakarta.transaction.TransactionManager;
+import org.apache.camel.component.jms.JmsComponent;
+import org.eclipse.microprofile.config.ConfigProvider;
+import org.springframework.transaction.jta.JtaTransactionManager;
+
+public class Producers {
+    /**
+     * Create a connection factory for IBM MQ.
+     * <p/>
+     * Since there is no IBM MQ extension for quarkus, we need to create the connection factory manually
+     *
+     * @param  wrapper wrapper that is used to add pooling capabilities to the connection facory
+     * @return         a new connection factory instance
+     */
+    @Identifier("ibmConnectionFactory")
+    public ConnectionFactory createXAConnectionFactory(PooledJmsWrapper wrapper) {
+        MQXAConnectionFactory mq = new MQXAConnectionFactory();
+        try {
+            mq.setHostName(ConfigProvider.getConfig().getValue("ibm.mq.host", String.class));
+            mq.setPort(ConfigProvider.getConfig().getValue("ibm.mq.port", Integer.class));
+            mq.setChannel(ConfigProvider.getConfig().getValue("ibm.mq.channel", String.class));
+            mq.setQueueManager(ConfigProvider.getConfig().getValue("ibm.mq.queueManagerName", String.class));
+            mq.setTransportType(WMQConstants.WMQ_CM_CLIENT);
+            mq.setStringProperty(WMQConstants.USERID,
+                    ConfigProvider.getConfig().getValue("ibm.mq.user", String.class));
+            mq.setStringProperty(WMQConstants.PASSWORD,
+                    ConfigProvider.getConfig().getValue("ibm.mq.password", String.class));
+        } catch (JMSException e) {
+            throw new RuntimeException("Unable to create IBM MQ Connection Factory", e);
+        }
+        return wrapper.wrapConnectionFactory(mq);
+    }
+
+    /**
+     * Define the JtaTransactionManager instance that is used in jms components.
+     *
+     * @param  transactionManager transaction manager
+     * @return                    JtaTransactionManager instance
+     */
+    @Default
+    JtaTransactionManager manager(TransactionManager transactionManager) {
+        return new JtaTransactionManager(transactionManager);
+    }
+
+    /**
+     * Define the "ibmmq" jms component.
+     *
+     * @param  cf ibm mq connection factory that is automatically injected by Quarkus based on the given identifier
+     * @param  tm transaction manager to use
+     * @return    a new JmsComponent instance
+     */
+    @Identifier("ibmmq")
+    JmsComponent ibmmq(@Identifier("ibmConnectionFactory") ConnectionFactory cf, JtaTransactionManager tm) {

Review Comment:
   I think it should use the same `JtaTansactionManager`.



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "avano (via GitHub)" <gi...@apache.org>.
avano commented on PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#issuecomment-1757456360

   > When executing `mvn clean compile quarkus:dev`, There is a WARN log:
   > 
   > ```
   > ================================================================================
   > CDI: programmatic lookup problem detected
   > -----------------------------------------
   > At least one bean matched the required type and qualifiers but was marked as unused and removed during build
   > 
   > Stack frame: io.quarkus.arc.runtime.BeanContainerImpl.beanInstanceFactory(BeanContainerImpl.java:26)
   > Required type: class org.apache.camel.component.servlet.CamelHttpTransportServlet
   > Required qualifiers: [@jakarta.enterprise.inject.Default()]
   > Removed beans:
   > 	- CLASS bean  [types=[class org.apache.camel.http.common.CamelServlet, class jakarta.servlet.http.HttpServlet, class jakarta.servlet.GenericServlet, class org.apache.camel.component.servlet.CamelHttpTransportServlet, interface jakarta.servlet.Servlet, interface java.io.Serializable, interface org.apache.camel.http.common.HttpRegistryProvider, interface jakarta.servlet.ServletConfig], qualifiers=null]
   > Solutions:
   > 	- Application developers can eliminate false positives via the @Unremovable annotation
   > 	- Extensions can eliminate false positives via build items, e.g. using the UnremovableBeanBuildItem
   > 	- See also https://quarkus.io/guides/cdi-reference#remove_unused_beans
   > 	- Enable the DEBUG log level to see the full stack trace
   > ```
   
   will be fixed by removing the servlet dependency, as mentioned by James


-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1360702639


##########
message-bridge/README.adoc:
##########
@@ -0,0 +1,206 @@
+= Message Bridge: A Camel Quarkus example
+:cq-example-description: An example that shows how to configure AMQ and IBM MQ clients to use the connection pooling and XA transactions.
+
+{cq-description}
+
+TIP: Check the https://camel.apache.org/camel-quarkus/latest/first-steps.html[Camel Quarkus User guide] for prerequisites
+and other general information.
+
+== Overview
+
+In this example, a basic REST endpoint is provided for users to dispatch a message to the IBM MQ queue. Subsequently, all messages from the IBM MQ are relayed to an ActiveMQ queue within an XA transaction. To showcase the transaction functionality, a message containing the keyword "rollback" will initiate a transaction rollback. To demonstrate the process of a transaction recovery after a crash, send a message with they keyword "crash".
+
+Details regarding client configurations can be located in the `src/main/resources/application.properties` file.
+
+== Prerequisites
+
+First start the ActiveMQ broker:
+----
+docker run \
+  -d \
+  -e AMQ_USER=admin \
+  -e AMQ_PASSWORD=admin \
+  -p 61616:61616 \
+  quay.io/artemiscloud/activemq-artemis-broker
+----
+
+Then start the IBM MQ broker:
+----
+docker run \
+  -d \
+  -e LICENSE=accept \
+  -e MQ_QMGR_NAME=QM1 \
+  -e MQ_APP_PASSWORD=passw0rd \
+  -p 1414:1414 \
+  icr.io/ibm-messaging/mq:9.3.2.1-r1
+----
+
+== 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.
+
+After the application is started, you can send messages to the IBMMQ queue using the rest endpoint `/message`:
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello World'
+----
+
+In the application logs you will see:
+
+----
+2023-10-11 08:10:52,782 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello World
+2023-10-11 08:10:52,903 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello World
+2023-10-11 08:10:52,927 INFO  [amq] (Camel (camel-4) thread #8 - JmsConsumer[in]) ActiveMQ received: Hello World
+----
+
+The message is initially dispatched to an IBMMQ queue, then relayed to an ActiveMQ queue, and ultimately retrieved from the ActiveMQ queue and printed to the log without any issues.
+
+=== Transaction rollback
+
+If you wish to illustrate a rollback, simply send a message containing the `rollback` keyword.
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello rollback'
+----
+The log could be divided into two segments. In this demonstration, the IBMMQ to ActiveMQ route is configured to simulate a transaction rollback following the dispatch of a message to the ActiveMQ queue. Due to the rollback, you'll notice that the message isn't fetched from the ActiveMQ queue and isn't logged:
+
+----
+2023-10-11 08:12:46,314 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello rollback
+2023-10-11 08:12:46,453 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello rollback
+2023-10-11 08:12:46,457 WARN  [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Transaction rollback (0xea2b886) redelivered(false) for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003) caught: Simulated rollback
+2023-10-11 08:12:46,458 ERROR [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Failed delivery for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003). Exhausted after delivery attempt: 1 caught: java.lang.RuntimeException: Simulated rollback
+...
+<truncated exception from the simulated rollback>
+----
+
+Because the transaction was rolled back, the message wasn't successfully processed and it is returned to the IBMMQ queue and subsequently redelivered. In this instance, the delivery is successful and logged accordingly:
+
+----
+2023-10-11 08:12:46,561 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Redelivering message after rollback to ActiveMQ: Hello rollback
+2023-10-11 08:12:46,567 INFO  [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Transaction commit (0xea2b886) redelivered(true) for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000004))
+2023-10-11 08:12:46,585 INFO  [amq] (Camel (camel-4) thread #8 - JmsConsumer[in]) ActiveMQ received: Hello rollback
+----
+
+In this example, a local file transaction storage is used, which is set up through the `quarkus.transaction-manager.object-store.directory` property. If you prefer to utilize a database for configuring the storage, please refer to the Quarkus transactions guide available at https://quarkus.io/guides/transaction#jdbcstore.
+
+=== Transaction recovery
+
+To trigger a JVM crash during the transaction, send a message containing the word `crash`.
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello crash'
+----
+
+This will result in the JVM stopping abruptly:
+
+----
+2023-10-13 15:21:03,277 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: crash
+2023-10-13 15:21:03,429 INFO  [ibmmq-amq] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: crash
+2023-10-13 15:21:03,449 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Preparing DummyXAResource
+2023-10-13 15:21:03,461 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Committing DummyXAResource
+2023-10-13 15:21:03,461 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Crashing the system
+----
+
+Upon restarting the application, after a few seconds you will observe that the transaction has been restored, and the message has been successfully delivered to the ActiveMQ broker.
+
+----
+2023-10-13 15:21:36,458 INFO  [io.quarkus] (main) camel-quarkus-examples-message-bridge 3.5.0-SNAPSHOT on JVM (powered by Quarkus 3.5.0.CR1) started in 0.893s. Listening on: http://0.0.0.0:8080
+2023-10-13 15:21:36,459 INFO  [io.quarkus] (main) Profile prod activated.
+2023-10-13 15:21:36,459 INFO  [io.quarkus] (main) Installed features: [artemis-jms, camel-attachments, camel-core, camel-direct, camel-jms, camel-jta, camel-platform-http, camel-rest, cdi, messaginghub-pooled-jms, narayana-jta, smallrye-context-propagation, vertx]
+2023-10-13 15:21:46,386 INFO  [org.acm.mes.bri.DummyXAResourceRecovery] (Periodic Recovery) DummyXAResourceRecovery returning list of resources: [org.acme.message.bridge.DummyXAResource@3739f1f4, org.acme.message.bridge.DummyXAResource@7d2113fb]
+2023-10-13 15:21:46,391 WARN  [com.arj.ats.jta] (Periodic Recovery) ARJUNA016037: Could not find new XAResource to use for recovering non-serializable XAResource XAResourceRecord < resource:null, txid:< formatId=131077, gtrid_length=35, bqual_length=36, tx_uid=0:ffffc0a80136:8e8b:65294417:31, node_name=quarkus, branch_uid=0:ffffc0a80136:8e8b:65294417:33, subordinatenodename=null, eis_name=0 >, heuristic: TwoPhaseOutcome.FINISH_OK com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord@1d57754e >
+2023-10-13 15:21:46,483 INFO  [org.acm.mes.bri.DummyXAResourceRecovery] (Periodic Recovery) DummyXAResourceRecovery returning list of resources: [org.acme.message.bridge.DummyXAResource@24a51dd0, org.acme.message.bridge.DummyXAResource@4fc1b14d]
+2023-10-13 15:21:46,484 WARN  [com.arj.ats.jta] (Periodic Recovery) ARJUNA016038: No XAResource to recover < formatId=131077, gtrid_length=35, bqual_length=36, tx_uid=0:ffffc0a80136:8e8b:65294417:31, node_name=quarkus, branch_uid=0:ffffc0a80136:8e8b:65294417:33, subordinatenodename=null, eis_name=0 >
+2023-10-13 15:21:46,485 INFO  [org.acm.mes.bri.DummyXAResource] (Periodic Recovery) Committing DummyXAResource
+2023-10-13 15:21:46,512 INFO  [amq] (Camel (camel-1) thread #2 - JmsConsumer[in]) ActiveMQ received: crash
+----
+
+You may observe the warning messages related to the XAResource recovery in the logs. This is a known issue related to how we simulate the crash of the system and can be ignored.
+
+=== 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]
+
+==== JVM mode
+
+[source,shell]
+----
+$ mvn clean package
+$ java -jar target/quarkus-app/quarkus-run.jar
+...
+[io.quarkus] (main) camel-quarkus-examples-... started in 1.163s.
+----
+
+=== Running on OpenShift
+
+You can also deploy this example as an OpenShift pod using the capabilities of the quarkus-maven-plugin.
+
+Before doing so, make sure to deploy the AMQ and IBMMQ brokers:
+
+----
+oc new-app quay.io/artemiscloud/activemq-artemis-broker -e AMQ_USER=admin -e AMQ_PASSWORD=admin
+oc patch service/activemq-artemis-broker -p '{"spec":{"ports":[{"name":"61616-tcp", "port": 61616, "protocol": "TCP", "targetPort": 61616}]}}'
+----
+
+----
+oc new-app icr.io/ibm-messaging/mq:9.3.2.1-r1 -e MQ_QMGR_NAME=QM1 -e LICENSE=accept -e MQ_APP_PASSWORD=passw0rd
+----
+
+Next, create a `PersistentVolumeClaim` to serve as the storage for the transaction manager's object store. This example assumes that a persistent volume claim named `message-bridge` has already been set up. Keep in mind that the configuration of the persistent volume may require adjustments based on your specific OpenShift setup:
+
+----
+oc create -f - <<EOF
+kind: PersistentVolumeClaim
+apiVersion: v1
+metadata:
+  name: message-bridge
+spec:
+  accessModes:
+    - ReadWriteOnce
+  resources:
+    requests:
+      storage: 1Gi
+EOF
+----
+
+Then deploy this example using the `openshift` profile specified within this project:
+
+----
+mvn clean package -DskipTests -Popenshift
+----
+
+Once the pod is up and running successfully, you can send messages in a manner similar to local deployment:
+
+----
+curl -X POST -H "Content-Type: text/plain" http://$(oc get route camel-quarkus-examples-message-bridge -o jsonpath='{.spec.host}')/message -d 'Hello world'
+----
+
+=== Running the tests
+
+This example comes with a couple of integration tests that verify the correct functionality. Before running the tests examine the IBM MQ license with:
+
+----

Review Comment:
   This one seems not to work, locally it outputs:
   
   ```
   ...
   2023-10-16T13:49:24.309Z License not accepted
   ```
   
   Is it really needed to run this docker container actually ?
   Indeed, it looks like the `mvn clean verify ...` command runs well without the docker command line executed.



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1360702639


##########
message-bridge/README.adoc:
##########
@@ -0,0 +1,206 @@
+= Message Bridge: A Camel Quarkus example
+:cq-example-description: An example that shows how to configure AMQ and IBM MQ clients to use the connection pooling and XA transactions.
+
+{cq-description}
+
+TIP: Check the https://camel.apache.org/camel-quarkus/latest/first-steps.html[Camel Quarkus User guide] for prerequisites
+and other general information.
+
+== Overview
+
+In this example, a basic REST endpoint is provided for users to dispatch a message to the IBM MQ queue. Subsequently, all messages from the IBM MQ are relayed to an ActiveMQ queue within an XA transaction. To showcase the transaction functionality, a message containing the keyword "rollback" will initiate a transaction rollback. To demonstrate the process of a transaction recovery after a crash, send a message with they keyword "crash".
+
+Details regarding client configurations can be located in the `src/main/resources/application.properties` file.
+
+== Prerequisites
+
+First start the ActiveMQ broker:
+----
+docker run \
+  -d \
+  -e AMQ_USER=admin \
+  -e AMQ_PASSWORD=admin \
+  -p 61616:61616 \
+  quay.io/artemiscloud/activemq-artemis-broker
+----
+
+Then start the IBM MQ broker:
+----
+docker run \
+  -d \
+  -e LICENSE=accept \
+  -e MQ_QMGR_NAME=QM1 \
+  -e MQ_APP_PASSWORD=passw0rd \
+  -p 1414:1414 \
+  icr.io/ibm-messaging/mq:9.3.2.1-r1
+----
+
+== 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.
+
+After the application is started, you can send messages to the IBMMQ queue using the rest endpoint `/message`:
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello World'
+----
+
+In the application logs you will see:
+
+----
+2023-10-11 08:10:52,782 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello World
+2023-10-11 08:10:52,903 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello World
+2023-10-11 08:10:52,927 INFO  [amq] (Camel (camel-4) thread #8 - JmsConsumer[in]) ActiveMQ received: Hello World
+----
+
+The message is initially dispatched to an IBMMQ queue, then relayed to an ActiveMQ queue, and ultimately retrieved from the ActiveMQ queue and printed to the log without any issues.
+
+=== Transaction rollback
+
+If you wish to illustrate a rollback, simply send a message containing the `rollback` keyword.
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello rollback'
+----
+The log could be divided into two segments. In this demonstration, the IBMMQ to ActiveMQ route is configured to simulate a transaction rollback following the dispatch of a message to the ActiveMQ queue. Due to the rollback, you'll notice that the message isn't fetched from the ActiveMQ queue and isn't logged:
+
+----
+2023-10-11 08:12:46,314 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello rollback
+2023-10-11 08:12:46,453 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello rollback
+2023-10-11 08:12:46,457 WARN  [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Transaction rollback (0xea2b886) redelivered(false) for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003) caught: Simulated rollback
+2023-10-11 08:12:46,458 ERROR [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Failed delivery for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003). Exhausted after delivery attempt: 1 caught: java.lang.RuntimeException: Simulated rollback
+...
+<truncated exception from the simulated rollback>
+----
+
+Because the transaction was rolled back, the message wasn't successfully processed and it is returned to the IBMMQ queue and subsequently redelivered. In this instance, the delivery is successful and logged accordingly:
+
+----
+2023-10-11 08:12:46,561 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Redelivering message after rollback to ActiveMQ: Hello rollback
+2023-10-11 08:12:46,567 INFO  [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Transaction commit (0xea2b886) redelivered(true) for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000004))
+2023-10-11 08:12:46,585 INFO  [amq] (Camel (camel-4) thread #8 - JmsConsumer[in]) ActiveMQ received: Hello rollback
+----
+
+In this example, a local file transaction storage is used, which is set up through the `quarkus.transaction-manager.object-store.directory` property. If you prefer to utilize a database for configuring the storage, please refer to the Quarkus transactions guide available at https://quarkus.io/guides/transaction#jdbcstore.
+
+=== Transaction recovery
+
+To trigger a JVM crash during the transaction, send a message containing the word `crash`.
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello crash'
+----
+
+This will result in the JVM stopping abruptly:
+
+----
+2023-10-13 15:21:03,277 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: crash
+2023-10-13 15:21:03,429 INFO  [ibmmq-amq] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: crash
+2023-10-13 15:21:03,449 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Preparing DummyXAResource
+2023-10-13 15:21:03,461 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Committing DummyXAResource
+2023-10-13 15:21:03,461 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Crashing the system
+----
+
+Upon restarting the application, after a few seconds you will observe that the transaction has been restored, and the message has been successfully delivered to the ActiveMQ broker.
+
+----
+2023-10-13 15:21:36,458 INFO  [io.quarkus] (main) camel-quarkus-examples-message-bridge 3.5.0-SNAPSHOT on JVM (powered by Quarkus 3.5.0.CR1) started in 0.893s. Listening on: http://0.0.0.0:8080
+2023-10-13 15:21:36,459 INFO  [io.quarkus] (main) Profile prod activated.
+2023-10-13 15:21:36,459 INFO  [io.quarkus] (main) Installed features: [artemis-jms, camel-attachments, camel-core, camel-direct, camel-jms, camel-jta, camel-platform-http, camel-rest, cdi, messaginghub-pooled-jms, narayana-jta, smallrye-context-propagation, vertx]
+2023-10-13 15:21:46,386 INFO  [org.acm.mes.bri.DummyXAResourceRecovery] (Periodic Recovery) DummyXAResourceRecovery returning list of resources: [org.acme.message.bridge.DummyXAResource@3739f1f4, org.acme.message.bridge.DummyXAResource@7d2113fb]
+2023-10-13 15:21:46,391 WARN  [com.arj.ats.jta] (Periodic Recovery) ARJUNA016037: Could not find new XAResource to use for recovering non-serializable XAResource XAResourceRecord < resource:null, txid:< formatId=131077, gtrid_length=35, bqual_length=36, tx_uid=0:ffffc0a80136:8e8b:65294417:31, node_name=quarkus, branch_uid=0:ffffc0a80136:8e8b:65294417:33, subordinatenodename=null, eis_name=0 >, heuristic: TwoPhaseOutcome.FINISH_OK com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord@1d57754e >
+2023-10-13 15:21:46,483 INFO  [org.acm.mes.bri.DummyXAResourceRecovery] (Periodic Recovery) DummyXAResourceRecovery returning list of resources: [org.acme.message.bridge.DummyXAResource@24a51dd0, org.acme.message.bridge.DummyXAResource@4fc1b14d]
+2023-10-13 15:21:46,484 WARN  [com.arj.ats.jta] (Periodic Recovery) ARJUNA016038: No XAResource to recover < formatId=131077, gtrid_length=35, bqual_length=36, tx_uid=0:ffffc0a80136:8e8b:65294417:31, node_name=quarkus, branch_uid=0:ffffc0a80136:8e8b:65294417:33, subordinatenodename=null, eis_name=0 >
+2023-10-13 15:21:46,485 INFO  [org.acm.mes.bri.DummyXAResource] (Periodic Recovery) Committing DummyXAResource
+2023-10-13 15:21:46,512 INFO  [amq] (Camel (camel-1) thread #2 - JmsConsumer[in]) ActiveMQ received: crash
+----
+
+You may observe the warning messages related to the XAResource recovery in the logs. This is a known issue related to how we simulate the crash of the system and can be ignored.
+
+=== 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]
+
+==== JVM mode
+
+[source,shell]
+----
+$ mvn clean package
+$ java -jar target/quarkus-app/quarkus-run.jar
+...
+[io.quarkus] (main) camel-quarkus-examples-... started in 1.163s.
+----
+
+=== Running on OpenShift
+
+You can also deploy this example as an OpenShift pod using the capabilities of the quarkus-maven-plugin.
+
+Before doing so, make sure to deploy the AMQ and IBMMQ brokers:
+
+----
+oc new-app quay.io/artemiscloud/activemq-artemis-broker -e AMQ_USER=admin -e AMQ_PASSWORD=admin
+oc patch service/activemq-artemis-broker -p '{"spec":{"ports":[{"name":"61616-tcp", "port": 61616, "protocol": "TCP", "targetPort": 61616}]}}'
+----
+
+----
+oc new-app icr.io/ibm-messaging/mq:9.3.2.1-r1 -e MQ_QMGR_NAME=QM1 -e LICENSE=accept -e MQ_APP_PASSWORD=passw0rd
+----
+
+Next, create a `PersistentVolumeClaim` to serve as the storage for the transaction manager's object store. This example assumes that a persistent volume claim named `message-bridge` has already been set up. Keep in mind that the configuration of the persistent volume may require adjustments based on your specific OpenShift setup:
+
+----
+oc create -f - <<EOF
+kind: PersistentVolumeClaim
+apiVersion: v1
+metadata:
+  name: message-bridge
+spec:
+  accessModes:
+    - ReadWriteOnce
+  resources:
+    requests:
+      storage: 1Gi
+EOF
+----
+
+Then deploy this example using the `openshift` profile specified within this project:
+
+----
+mvn clean package -DskipTests -Popenshift
+----
+
+Once the pod is up and running successfully, you can send messages in a manner similar to local deployment:
+
+----
+curl -X POST -H "Content-Type: text/plain" http://$(oc get route camel-quarkus-examples-message-bridge -o jsonpath='{.spec.host}')/message -d 'Hello world'
+----
+
+=== Running the tests
+
+This example comes with a couple of integration tests that verify the correct functionality. Before running the tests examine the IBM MQ license with:
+
+----

Review Comment:
   This one seems not to work, locally it outputs:
   
   ```
   ...
   2023-10-16T13:49:24.309Z License not accepted
   ```
   
   Is it really needed to run this docker container actually.
   Indeed, it looks like the `mvn clean verify ...` command runs well without the docker command line executed.



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#issuecomment-1757536765

   By the way, this is really a good starter @avano. We may well find some users that would find this example extremely helpful :clap: 


-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng commented on PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#issuecomment-1757603203

   The object store directory can be config by setting `quarkus.transaction-manager.object-store.directory`.


-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1357918522


##########
message-bridge/pom.xml:
##########
@@ -0,0 +1,274 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<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>
+
+    <artifactId>camel-quarkus-examples-message-bridge</artifactId>
+    <groupId>org.apache.camel.quarkus.examples</groupId>
+    <version>3.5.0-SNAPSHOT</version>
+
+    <name>Camel Quarkus :: Examples :: Message Bridge</name>
+    <description>Camel Quarkus Example :: Configure XA Transactions and connection pooling</description>
+
+    <properties>
+        <quarkus.platform.version>3.4.1</quarkus.platform.version>

Review Comment:
   ```suggestion
           <quarkus.platform.version>3.5.0.CR1</quarkus.platform.version>
   ```



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1354705253


##########
message-bridge/README.adoc:
##########
@@ -0,0 +1,107 @@
+= Message Bridge: A Camel Quarkus example
+:cq-example-description: An example that shows how to configure AMQ and IBM MQ clients to use the connection pooling and XA transactions.
+
+{cq-description}
+
+TIP: Check the https://camel.apache.org/camel-quarkus/latest/first-steps.html[Camel Quarkus User guide] for prerequisites
+and other general information.
+
+== Overview
+
+In this example, a basic REST endpoint is provided for users to dispatch a message to the IBM MQ queue. Subsequently, all messages from the IBM MQ are relayed to an ActiveMQ queue within an XA transaction. To showcase the transaction functionality, a message containing the keyword "rollback" will initiate a transaction rollback.
+
+Details regarding client configurations can be located in the link:src/main/resources/application.properties file.
+
+== Prerequisites
+
+First start the ActiveMQ broker:
+----
+docker run \
+  -e AMQ_USER=admin -e AMQ_PASSWORD=admin \
+  -d -p 61616:61616 \
+  quay.io/artemiscloud/activemq-artemis-broker
+----
+
+Then start the IBM MQ broker:
+----
+docker run \
+  -e LICENSE=accept \
+  -e MQ_QMGR_NAME=QM1 \
+  -e MQ_APP_PASSWORD=passw0rd \
+  -p 1414:1414

Review Comment:
   Is there a missing "\" at the end of this line ?



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#issuecomment-1757464984

   Executing locally, there are some files that should probably be git ignored:
   
   ```
   [main_upstream @ message-bridge]$ git status
   HEAD detached at avano/ibmmq-amq
   Untracked files:
     (use "git add <file>..." to include in what will be committed)
   	FFDC/
   	mqjms.log.0
   ```
   
   The FFDC folder looks like a kind of internal logs to get support. And the mqjms is just a log file. Maybe we could just git ignore them ?


-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1354590180


##########
message-bridge/eclipse-formatter-config.xml:
##########


Review Comment:
   OK - sorry, I have not noticed it.



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1360570138


##########
message-bridge/README.adoc:
##########
@@ -0,0 +1,206 @@
+= Message Bridge: A Camel Quarkus example
+:cq-example-description: An example that shows how to configure AMQ and IBM MQ clients to use the connection pooling and XA transactions.
+
+{cq-description}
+
+TIP: Check the https://camel.apache.org/camel-quarkus/latest/first-steps.html[Camel Quarkus User guide] for prerequisites
+and other general information.
+
+== Overview
+
+In this example, a basic REST endpoint is provided for users to dispatch a message to the IBM MQ queue. Subsequently, all messages from the IBM MQ are relayed to an ActiveMQ queue within an XA transaction. To showcase the transaction functionality, a message containing the keyword "rollback" will initiate a transaction rollback. To demonstrate the process of a transaction recovery after a crash, send a message with they keyword "crash".
+
+Details regarding client configurations can be located in the `src/main/resources/application.properties` file.
+
+== Prerequisites
+
+First start the ActiveMQ broker:
+----
+docker run \
+  -d \
+  -e AMQ_USER=admin \
+  -e AMQ_PASSWORD=admin \
+  -p 61616:61616 \
+  quay.io/artemiscloud/activemq-artemis-broker
+----
+
+Then start the IBM MQ broker:
+----
+docker run \
+  -d \
+  -e LICENSE=accept \
+  -e MQ_QMGR_NAME=QM1 \
+  -e MQ_APP_PASSWORD=passw0rd \
+  -p 1414:1414 \
+  icr.io/ibm-messaging/mq:9.3.2.1-r1
+----
+
+== 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.
+
+After the application is started, you can send messages to the IBMMQ queue using the rest endpoint `/message`:
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello World'
+----
+
+In the application logs you will see:
+
+----
+2023-10-11 08:10:52,782 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello World
+2023-10-11 08:10:52,903 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello World
+2023-10-11 08:10:52,927 INFO  [amq] (Camel (camel-4) thread #8 - JmsConsumer[in]) ActiveMQ received: Hello World
+----
+
+The message is initially dispatched to an IBMMQ queue, then relayed to an ActiveMQ queue, and ultimately retrieved from the ActiveMQ queue and printed to the log without any issues.
+
+=== Transaction rollback
+
+If you wish to illustrate a rollback, simply send a message containing the `rollback` keyword.
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello rollback'
+----
+The log could be divided into two segments. In this demonstration, the IBMMQ to ActiveMQ route is configured to simulate a transaction rollback following the dispatch of a message to the ActiveMQ queue. Due to the rollback, you'll notice that the message isn't fetched from the ActiveMQ queue and isn't logged:
+
+----
+2023-10-11 08:12:46,314 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello rollback
+2023-10-11 08:12:46,453 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello rollback
+2023-10-11 08:12:46,457 WARN  [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Transaction rollback (0xea2b886) redelivered(false) for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003) caught: Simulated rollback
+2023-10-11 08:12:46,458 ERROR [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Failed delivery for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003). Exhausted after delivery attempt: 1 caught: java.lang.RuntimeException: Simulated rollback
+...
+<truncated exception from the simulated rollback>
+----
+
+Because the transaction was rolled back, the message wasn't successfully processed and it is returned to the IBMMQ queue and subsequently redelivered. In this instance, the delivery is successful and logged accordingly:
+
+----
+2023-10-11 08:12:46,561 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Redelivering message after rollback to ActiveMQ: Hello rollback
+2023-10-11 08:12:46,567 INFO  [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Transaction commit (0xea2b886) redelivered(true) for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000004))
+2023-10-11 08:12:46,585 INFO  [amq] (Camel (camel-4) thread #8 - JmsConsumer[in]) ActiveMQ received: Hello rollback
+----
+
+In this example, a local file transaction storage is used, which is set up through the `quarkus.transaction-manager.object-store.directory` property. If you prefer to utilize a database for configuring the storage, please refer to the Quarkus transactions guide available at https://quarkus.io/guides/transaction#jdbcstore.
+
+=== Transaction recovery
+
+To trigger a JVM crash during the transaction, send a message containing the word `crash`.
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello rollback'

Review Comment:
   I assume here should be `Hello crash`?



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1360708046


##########
message-bridge/README.adoc:
##########
@@ -0,0 +1,206 @@
+= Message Bridge: A Camel Quarkus example
+:cq-example-description: An example that shows how to configure AMQ and IBM MQ clients to use the connection pooling and XA transactions.
+
+{cq-description}
+
+TIP: Check the https://camel.apache.org/camel-quarkus/latest/first-steps.html[Camel Quarkus User guide] for prerequisites
+and other general information.
+
+== Overview
+
+In this example, a basic REST endpoint is provided for users to dispatch a message to the IBM MQ queue. Subsequently, all messages from the IBM MQ are relayed to an ActiveMQ queue within an XA transaction. To showcase the transaction functionality, a message containing the keyword "rollback" will initiate a transaction rollback. To demonstrate the process of a transaction recovery after a crash, send a message with they keyword "crash".
+
+Details regarding client configurations can be located in the `src/main/resources/application.properties` file.
+
+== Prerequisites
+
+First start the ActiveMQ broker:
+----
+docker run \
+  -d \
+  -e AMQ_USER=admin \
+  -e AMQ_PASSWORD=admin \
+  -p 61616:61616 \
+  quay.io/artemiscloud/activemq-artemis-broker
+----
+
+Then start the IBM MQ broker:
+----
+docker run \
+  -d \
+  -e LICENSE=accept \
+  -e MQ_QMGR_NAME=QM1 \
+  -e MQ_APP_PASSWORD=passw0rd \
+  -p 1414:1414 \
+  icr.io/ibm-messaging/mq:9.3.2.1-r1
+----
+
+== 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.
+
+After the application is started, you can send messages to the IBMMQ queue using the rest endpoint `/message`:
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello World'
+----
+
+In the application logs you will see:
+
+----
+2023-10-11 08:10:52,782 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello World
+2023-10-11 08:10:52,903 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello World
+2023-10-11 08:10:52,927 INFO  [amq] (Camel (camel-4) thread #8 - JmsConsumer[in]) ActiveMQ received: Hello World
+----
+
+The message is initially dispatched to an IBMMQ queue, then relayed to an ActiveMQ queue, and ultimately retrieved from the ActiveMQ queue and printed to the log without any issues.
+
+=== Transaction rollback
+
+If you wish to illustrate a rollback, simply send a message containing the `rollback` keyword.
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello rollback'
+----
+The log could be divided into two segments. In this demonstration, the IBMMQ to ActiveMQ route is configured to simulate a transaction rollback following the dispatch of a message to the ActiveMQ queue. Due to the rollback, you'll notice that the message isn't fetched from the ActiveMQ queue and isn't logged:
+
+----
+2023-10-11 08:12:46,314 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello rollback
+2023-10-11 08:12:46,453 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello rollback
+2023-10-11 08:12:46,457 WARN  [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Transaction rollback (0xea2b886) redelivered(false) for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003) caught: Simulated rollback
+2023-10-11 08:12:46,458 ERROR [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Failed delivery for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003). Exhausted after delivery attempt: 1 caught: java.lang.RuntimeException: Simulated rollback
+...
+<truncated exception from the simulated rollback>
+----
+
+Because the transaction was rolled back, the message wasn't successfully processed and it is returned to the IBMMQ queue and subsequently redelivered. In this instance, the delivery is successful and logged accordingly:
+
+----
+2023-10-11 08:12:46,561 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Redelivering message after rollback to ActiveMQ: Hello rollback
+2023-10-11 08:12:46,567 INFO  [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Transaction commit (0xea2b886) redelivered(true) for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000004))
+2023-10-11 08:12:46,585 INFO  [amq] (Camel (camel-4) thread #8 - JmsConsumer[in]) ActiveMQ received: Hello rollback
+----
+
+In this example, a local file transaction storage is used, which is set up through the `quarkus.transaction-manager.object-store.directory` property. If you prefer to utilize a database for configuring the storage, please refer to the Quarkus transactions guide available at https://quarkus.io/guides/transaction#jdbcstore.
+
+=== Transaction recovery
+
+To trigger a JVM crash during the transaction, send a message containing the word `crash`.
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello crash'

Review Comment:
   Looks it doesn't work when re-executing the `mvn clean compile quarkus:dev` command.
   We need not to run clean, only `mvn compile quarkus:dev`.



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1360726390


##########
message-bridge/src/main/java/org/acme/message/bridge/Producers.java:
##########
@@ -0,0 +1,99 @@
+/*
+ * 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.
+ */
+package org.acme.message.bridge;
+
+import com.ibm.mq.jakarta.jms.MQXAConnectionFactory;
+import com.ibm.msg.client.jakarta.wmq.WMQConstants;
+import io.quarkiverse.messaginghub.pooled.jms.PooledJmsWrapper;
+import io.smallrye.common.annotation.Identifier;
+import jakarta.inject.Singleton;
+import jakarta.jms.ConnectionFactory;
+import jakarta.jms.JMSException;
+import jakarta.transaction.TransactionManager;
+import org.apache.camel.component.jms.JmsComponent;
+import org.eclipse.microprofile.config.ConfigProvider;
+import org.springframework.transaction.jta.JtaTransactionManager;
+
+public class Producers {
+    /**
+     * Create a connection factory for IBM MQ.
+     * <p/>
+     * Since there is no IBM MQ extension for quarkus, we need to create the connection factory manually
+     *
+     * @param  wrapper wrapper that is used to add pooling capabilities to the connection facory

Review Comment:
   nitpick typo: `factory`



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1354863539


##########
message-bridge/src/main/java/org/acme/message/bridge/Producers.java:
##########
@@ -0,0 +1,83 @@
+package org.acme.message.bridge;
+
+import com.ibm.mq.jakarta.jms.MQXAConnectionFactory;
+import com.ibm.msg.client.jakarta.wmq.WMQConstants;
+import io.quarkiverse.messaginghub.pooled.jms.PooledJmsWrapper;
+import io.smallrye.common.annotation.Identifier;
+import jakarta.enterprise.inject.Default;
+import jakarta.jms.ConnectionFactory;
+import jakarta.jms.JMSException;
+import jakarta.transaction.TransactionManager;
+import org.apache.camel.component.jms.JmsComponent;
+import org.eclipse.microprofile.config.ConfigProvider;
+import org.springframework.transaction.jta.JtaTransactionManager;
+
+public class Producers {
+    /**
+     * Create a connection factory for IBM MQ.
+     * <p/>
+     * Since there is no IBM MQ extension for quarkus, we need to create the connection factory manually
+     *
+     * @param  wrapper wrapper that is used to add pooling capabilities to the connection facory
+     * @return         a new connection factory instance
+     */
+    @Identifier("ibmConnectionFactory")
+    public ConnectionFactory createXAConnectionFactory(PooledJmsWrapper wrapper) {
+        MQXAConnectionFactory mq = new MQXAConnectionFactory();
+        try {
+            mq.setHostName(ConfigProvider.getConfig().getValue("ibm.mq.host", String.class));
+            mq.setPort(ConfigProvider.getConfig().getValue("ibm.mq.port", Integer.class));
+            mq.setChannel(ConfigProvider.getConfig().getValue("ibm.mq.channel", String.class));
+            mq.setQueueManager(ConfigProvider.getConfig().getValue("ibm.mq.queueManagerName", String.class));
+            mq.setTransportType(WMQConstants.WMQ_CM_CLIENT);
+            mq.setStringProperty(WMQConstants.USERID,
+                    ConfigProvider.getConfig().getValue("ibm.mq.user", String.class));
+            mq.setStringProperty(WMQConstants.PASSWORD,
+                    ConfigProvider.getConfig().getValue("ibm.mq.password", String.class));
+        } catch (JMSException e) {
+            throw new RuntimeException("Unable to create IBM MQ Connection Factory", e);
+        }
+        return wrapper.wrapConnectionFactory(mq);
+    }
+
+    /**
+     * Define the JtaTransactionManager instance that is used in jms components.
+     *
+     * @param  transactionManager transaction manager
+     * @return                    JtaTransactionManager instance
+     */
+    @Default
+    JtaTransactionManager manager(TransactionManager transactionManager) {
+        return new JtaTransactionManager(transactionManager);
+    }
+
+    /**
+     * Define the "ibmmq" jms component.
+     *
+     * @param  cf ibm mq connection factory that is automatically injected by Quarkus based on the given identifier
+     * @param  tm transaction manager to use
+     * @return    a new JmsComponent instance
+     */
+    @Identifier("ibmmq")
+    JmsComponent ibmmq(@Identifier("ibmConnectionFactory") ConnectionFactory cf, JtaTransactionManager tm) {

Review Comment:
   ok, so let's mark the jta transaction manager as singleton in that case.



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "avano (via GitHub)" <gi...@apache.org>.
avano commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1354561280


##########
message-bridge/src/main/java/org/acme/message/bridge/MessageBridgeRoute.java:
##########
@@ -0,0 +1,46 @@
+package org.acme.message.bridge;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import org.apache.camel.builder.RouteBuilder;
+
+@ApplicationScoped
+public class MessageBridgeRoute extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+        restConfiguration().component("servlet");
+        rest()
+                .post("/message")
+                .id("rest")
+                .to("direct:publish");
+
+        from("direct:publish")
+                .id("ibmmq")
+                .transacted()
+                .log("Sending message to IBMMQ: ${body}")
+                .to("ibmmq:queue:{{ibm.mq.queue}}?disableReplyTo=true");
+
+        from("ibmmq:queue:{{ibm.mq.queue}}")
+                .id("ibmmq-amq")
+                .transacted()
+                .choice()
+                .when(simple("${header.JMSRedelivered}"))
+                .log("Redelivering message after rollback to ActiveMQ: ${body}")
+                .otherwise()
+                .log("Sending message from IBMMQ to ActiveMQ: ${body}")
+                .end()
+                .to("amq:queue:{{amq.queue}}")
+                .process(ex -> {
+                    if (ex.getIn().getBody(String.class).toLowerCase().contains("rollback")) {
+                        if (!ex.getIn().getHeader("JMSRedelivered", Boolean.class)) {

Review Comment:
   yes, @aldettinger is correct, just some way how to proceed with the transaction after the rollback, I'll add a comment there



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#issuecomment-1757409645

   When executing `mvn clean compile quarkus:dev`, There is a WARN log:
   
   ```
   ================================================================================
   CDI: programmatic lookup problem detected
   -----------------------------------------
   At least one bean matched the required type and qualifiers but was marked as unused and removed during build
   
   Stack frame: io.quarkus.arc.runtime.BeanContainerImpl.beanInstanceFactory(BeanContainerImpl.java:26)
   Required type: class org.apache.camel.component.servlet.CamelHttpTransportServlet
   Required qualifiers: [@jakarta.enterprise.inject.Default()]
   Removed beans:
   	- CLASS bean  [types=[class org.apache.camel.http.common.CamelServlet, class jakarta.servlet.http.HttpServlet, class jakarta.servlet.GenericServlet, class org.apache.camel.component.servlet.CamelHttpTransportServlet, interface jakarta.servlet.Servlet, interface java.io.Serializable, interface org.apache.camel.http.common.HttpRegistryProvider, interface jakarta.servlet.ServletConfig], qualifiers=null]
   Solutions:
   	- Application developers can eliminate false positives via the @Unremovable annotation
   	- Extensions can eliminate false positives via build items, e.g. using the UnremovableBeanBuildItem
   	- See also https://quarkus.io/guides/cdi-reference#remove_unused_beans
   	- Enable the DEBUG log level to see the full stack trace
   ```


-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1354806084


##########
message-bridge/src/main/java/org/acme/message/bridge/Producers.java:
##########
@@ -0,0 +1,83 @@
+package org.acme.message.bridge;
+
+import com.ibm.mq.jakarta.jms.MQXAConnectionFactory;
+import com.ibm.msg.client.jakarta.wmq.WMQConstants;
+import io.quarkiverse.messaginghub.pooled.jms.PooledJmsWrapper;
+import io.smallrye.common.annotation.Identifier;
+import jakarta.enterprise.inject.Default;
+import jakarta.jms.ConnectionFactory;
+import jakarta.jms.JMSException;
+import jakarta.transaction.TransactionManager;
+import org.apache.camel.component.jms.JmsComponent;
+import org.eclipse.microprofile.config.ConfigProvider;
+import org.springframework.transaction.jta.JtaTransactionManager;
+
+public class Producers {
+    /**
+     * Create a connection factory for IBM MQ.
+     * <p/>
+     * Since there is no IBM MQ extension for quarkus, we need to create the connection factory manually
+     *
+     * @param  wrapper wrapper that is used to add pooling capabilities to the connection facory
+     * @return         a new connection factory instance
+     */
+    @Identifier("ibmConnectionFactory")
+    public ConnectionFactory createXAConnectionFactory(PooledJmsWrapper wrapper) {
+        MQXAConnectionFactory mq = new MQXAConnectionFactory();
+        try {
+            mq.setHostName(ConfigProvider.getConfig().getValue("ibm.mq.host", String.class));
+            mq.setPort(ConfigProvider.getConfig().getValue("ibm.mq.port", Integer.class));
+            mq.setChannel(ConfigProvider.getConfig().getValue("ibm.mq.channel", String.class));
+            mq.setQueueManager(ConfigProvider.getConfig().getValue("ibm.mq.queueManagerName", String.class));
+            mq.setTransportType(WMQConstants.WMQ_CM_CLIENT);
+            mq.setStringProperty(WMQConstants.USERID,
+                    ConfigProvider.getConfig().getValue("ibm.mq.user", String.class));
+            mq.setStringProperty(WMQConstants.PASSWORD,
+                    ConfigProvider.getConfig().getValue("ibm.mq.password", String.class));
+        } catch (JMSException e) {
+            throw new RuntimeException("Unable to create IBM MQ Connection Factory", e);
+        }
+        return wrapper.wrapConnectionFactory(mq);
+    }
+
+    /**
+     * Define the JtaTransactionManager instance that is used in jms components.
+     *
+     * @param  transactionManager transaction manager
+     * @return                    JtaTransactionManager instance
+     */
+    @Default
+    JtaTransactionManager manager(TransactionManager transactionManager) {
+        return new JtaTransactionManager(transactionManager);
+    }
+
+    /**
+     * Define the "ibmmq" jms component.
+     *
+     * @param  cf ibm mq connection factory that is automatically injected by Quarkus based on the given identifier
+     * @param  tm transaction manager to use
+     * @return    a new JmsComponent instance
+     */
+    @Identifier("ibmmq")
+    JmsComponent ibmmq(@Identifier("ibmConnectionFactory") ConnectionFactory cf, JtaTransactionManager tm) {

Review Comment:
   From local debug, the `JtaTransactionManager tm` reference is not the same between `ibmmq` and `amq`:
   
   ```
   ibm tm: org.springframework.transaction.jta.JtaTransactionManager@261db982
   amq tm: org.springframework.transaction.jta.JtaTransactionManager@3a90c13c
   ```
   
   @zhfeng @jamesnetherton Does one recall if this an issue ? Like we would need a singleton transaction manager to have both XAResource part of the same XA transaction ? Or maybe it's fine like this ?



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1361682379


##########
message-bridge/README.adoc:
##########
@@ -0,0 +1,206 @@
+= Message Bridge: A Camel Quarkus example
+:cq-example-description: An example that shows how to configure AMQ and IBM MQ clients to use the connection pooling and XA transactions.
+
+{cq-description}
+
+TIP: Check the https://camel.apache.org/camel-quarkus/latest/first-steps.html[Camel Quarkus User guide] for prerequisites
+and other general information.
+
+== Overview
+
+In this example, a basic REST endpoint is provided for users to dispatch a message to the IBM MQ queue. Subsequently, all messages from the IBM MQ are relayed to an ActiveMQ queue within an XA transaction. To showcase the transaction functionality, a message containing the keyword "rollback" will initiate a transaction rollback. To demonstrate the process of a transaction recovery after a crash, send a message with they keyword "crash".
+
+Details regarding client configurations can be located in the `src/main/resources/application.properties` file.
+
+== Prerequisites
+
+First start the ActiveMQ broker:
+----
+docker run \
+  -d \
+  -e AMQ_USER=admin \
+  -e AMQ_PASSWORD=admin \
+  -p 61616:61616 \
+  quay.io/artemiscloud/activemq-artemis-broker
+----
+
+Then start the IBM MQ broker:
+----
+docker run \
+  -d \
+  -e LICENSE=accept \
+  -e MQ_QMGR_NAME=QM1 \
+  -e MQ_APP_PASSWORD=passw0rd \
+  -p 1414:1414 \
+  icr.io/ibm-messaging/mq:9.3.2.1-r1
+----
+
+== 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.
+
+After the application is started, you can send messages to the IBMMQ queue using the rest endpoint `/message`:
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello World'
+----
+
+In the application logs you will see:
+
+----
+2023-10-11 08:10:52,782 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello World
+2023-10-11 08:10:52,903 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello World
+2023-10-11 08:10:52,927 INFO  [amq] (Camel (camel-4) thread #8 - JmsConsumer[in]) ActiveMQ received: Hello World
+----
+
+The message is initially dispatched to an IBMMQ queue, then relayed to an ActiveMQ queue, and ultimately retrieved from the ActiveMQ queue and printed to the log without any issues.
+
+=== Transaction rollback
+
+If you wish to illustrate a rollback, simply send a message containing the `rollback` keyword.
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello rollback'
+----
+The log could be divided into two segments. In this demonstration, the IBMMQ to ActiveMQ route is configured to simulate a transaction rollback following the dispatch of a message to the ActiveMQ queue. Due to the rollback, you'll notice that the message isn't fetched from the ActiveMQ queue and isn't logged:
+
+----
+2023-10-11 08:12:46,314 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello rollback
+2023-10-11 08:12:46,453 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello rollback
+2023-10-11 08:12:46,457 WARN  [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Transaction rollback (0xea2b886) redelivered(false) for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003) caught: Simulated rollback
+2023-10-11 08:12:46,458 ERROR [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Failed delivery for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003). Exhausted after delivery attempt: 1 caught: java.lang.RuntimeException: Simulated rollback
+...
+<truncated exception from the simulated rollback>
+----
+
+Because the transaction was rolled back, the message wasn't successfully processed and it is returned to the IBMMQ queue and subsequently redelivered. In this instance, the delivery is successful and logged accordingly:
+
+----
+2023-10-11 08:12:46,561 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Redelivering message after rollback to ActiveMQ: Hello rollback
+2023-10-11 08:12:46,567 INFO  [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Transaction commit (0xea2b886) redelivered(true) for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000004))
+2023-10-11 08:12:46,585 INFO  [amq] (Camel (camel-4) thread #8 - JmsConsumer[in]) ActiveMQ received: Hello rollback
+----
+
+In this example, a local file transaction storage is used, which is set up through the `quarkus.transaction-manager.object-store.directory` property. If you prefer to utilize a database for configuring the storage, please refer to the Quarkus transactions guide available at https://quarkus.io/guides/transaction#jdbcstore.
+
+=== Transaction recovery
+
+To trigger a JVM crash during the transaction, send a message containing the word `crash`.
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello crash'
+----
+
+This will result in the JVM stopping abruptly:
+
+----
+2023-10-13 15:21:03,277 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: crash
+2023-10-13 15:21:03,429 INFO  [ibmmq-amq] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: crash
+2023-10-13 15:21:03,449 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Preparing DummyXAResource
+2023-10-13 15:21:03,461 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Committing DummyXAResource
+2023-10-13 15:21:03,461 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Crashing the system
+----
+
+Upon restarting the application, after a few seconds you will observe that the transaction has been restored, and the message has been successfully delivered to the ActiveMQ broker.
+
+----
+2023-10-13 15:21:36,458 INFO  [io.quarkus] (main) camel-quarkus-examples-message-bridge 3.5.0-SNAPSHOT on JVM (powered by Quarkus 3.5.0.CR1) started in 0.893s. Listening on: http://0.0.0.0:8080
+2023-10-13 15:21:36,459 INFO  [io.quarkus] (main) Profile prod activated.
+2023-10-13 15:21:36,459 INFO  [io.quarkus] (main) Installed features: [artemis-jms, camel-attachments, camel-core, camel-direct, camel-jms, camel-jta, camel-platform-http, camel-rest, cdi, messaginghub-pooled-jms, narayana-jta, smallrye-context-propagation, vertx]
+2023-10-13 15:21:46,386 INFO  [org.acm.mes.bri.DummyXAResourceRecovery] (Periodic Recovery) DummyXAResourceRecovery returning list of resources: [org.acme.message.bridge.DummyXAResource@3739f1f4, org.acme.message.bridge.DummyXAResource@7d2113fb]
+2023-10-13 15:21:46,391 WARN  [com.arj.ats.jta] (Periodic Recovery) ARJUNA016037: Could not find new XAResource to use for recovering non-serializable XAResource XAResourceRecord < resource:null, txid:< formatId=131077, gtrid_length=35, bqual_length=36, tx_uid=0:ffffc0a80136:8e8b:65294417:31, node_name=quarkus, branch_uid=0:ffffc0a80136:8e8b:65294417:33, subordinatenodename=null, eis_name=0 >, heuristic: TwoPhaseOutcome.FINISH_OK com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord@1d57754e >
+2023-10-13 15:21:46,483 INFO  [org.acm.mes.bri.DummyXAResourceRecovery] (Periodic Recovery) DummyXAResourceRecovery returning list of resources: [org.acme.message.bridge.DummyXAResource@24a51dd0, org.acme.message.bridge.DummyXAResource@4fc1b14d]
+2023-10-13 15:21:46,484 WARN  [com.arj.ats.jta] (Periodic Recovery) ARJUNA016038: No XAResource to recover < formatId=131077, gtrid_length=35, bqual_length=36, tx_uid=0:ffffc0a80136:8e8b:65294417:31, node_name=quarkus, branch_uid=0:ffffc0a80136:8e8b:65294417:33, subordinatenodename=null, eis_name=0 >
+2023-10-13 15:21:46,485 INFO  [org.acm.mes.bri.DummyXAResource] (Periodic Recovery) Committing DummyXAResource
+2023-10-13 15:21:46,512 INFO  [amq] (Camel (camel-1) thread #2 - JmsConsumer[in]) ActiveMQ received: crash
+----
+
+You may observe the warning messages related to the XAResource recovery in the logs. This is a known issue related to how we simulate the crash of the system and can be ignored.
+
+=== 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]
+
+==== JVM mode
+
+[source,shell]
+----
+$ mvn clean package
+$ java -jar target/quarkus-app/quarkus-run.jar
+...
+[io.quarkus] (main) camel-quarkus-examples-... started in 1.163s.
+----
+
+=== Running on OpenShift
+
+You can also deploy this example as an OpenShift pod using the capabilities of the quarkus-maven-plugin.
+
+Before doing so, make sure to deploy the AMQ and IBMMQ brokers:
+
+----
+oc new-app quay.io/artemiscloud/activemq-artemis-broker -e AMQ_USER=admin -e AMQ_PASSWORD=admin
+oc patch service/activemq-artemis-broker -p '{"spec":{"ports":[{"name":"61616-tcp", "port": 61616, "protocol": "TCP", "targetPort": 61616}]}}'
+----
+
+----
+oc new-app icr.io/ibm-messaging/mq:9.3.2.1-r1 -e MQ_QMGR_NAME=QM1 -e LICENSE=accept -e MQ_APP_PASSWORD=passw0rd
+----
+
+Next, create a `PersistentVolumeClaim` to serve as the storage for the transaction manager's object store. This example assumes that a persistent volume claim named `message-bridge` has already been set up. Keep in mind that the configuration of the persistent volume may require adjustments based on your specific OpenShift setup:
+
+----
+oc create -f - <<EOF
+kind: PersistentVolumeClaim
+apiVersion: v1
+metadata:
+  name: message-bridge
+spec:
+  accessModes:
+    - ReadWriteOnce
+  resources:
+    requests:
+      storage: 1Gi
+EOF
+----
+
+Then deploy this example using the `openshift` profile specified within this project:
+
+----
+mvn clean package -DskipTests -Popenshift
+----
+
+Once the pod is up and running successfully, you can send messages in a manner similar to local deployment:
+
+----
+curl -X POST -H "Content-Type: text/plain" http://$(oc get route camel-quarkus-examples-message-bridge -o jsonpath='{.spec.host}')/message -d 'Hello world'
+----
+
+=== Running the tests
+
+This example comes with a couple of integration tests that verify the correct functionality. Before running the tests examine the IBM MQ license with:
+
+----

Review Comment:
   Many thanks for sharing, it's understood now :+1: 
   
   Thinking a bit more about the value of integration tests in examples. They actually prevent regressions, as we run the itests at each release when we [upgrade and tag examples](https://camel.apache.org/camel-quarkus/3.4.x/contributor-guide/release-guide.html#_upgrade_and_tag_examples). So, the rationale would be that it's not really up to the example user to read the license but more the developer that commit the code. We have kind of similar mechanism like [that](https://github.com/apache/camel-quarkus/blob/main/integration-test-groups/jdbc/mssql/src/test/resources/container-license-acceptance.txt).
   
   In this case, shouldn't we remove the test section from the README ? And then set the `LICENSE=accept` environment variable in the test config to show that the developers accept the license in the context of itests ? Or maybe setting `ibm.mq.container.license=accept` in `src/test/resources/application.properties `if it work ?



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "avano (via GitHub)" <gi...@apache.org>.
avano commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1360671391


##########
message-bridge/README.adoc:
##########
@@ -0,0 +1,206 @@
+= Message Bridge: A Camel Quarkus example
+:cq-example-description: An example that shows how to configure AMQ and IBM MQ clients to use the connection pooling and XA transactions.
+
+{cq-description}
+
+TIP: Check the https://camel.apache.org/camel-quarkus/latest/first-steps.html[Camel Quarkus User guide] for prerequisites
+and other general information.
+
+== Overview
+
+In this example, a basic REST endpoint is provided for users to dispatch a message to the IBM MQ queue. Subsequently, all messages from the IBM MQ are relayed to an ActiveMQ queue within an XA transaction. To showcase the transaction functionality, a message containing the keyword "rollback" will initiate a transaction rollback. To demonstrate the process of a transaction recovery after a crash, send a message with they keyword "crash".
+
+Details regarding client configurations can be located in the `src/main/resources/application.properties` file.
+
+== Prerequisites
+
+First start the ActiveMQ broker:
+----
+docker run \
+  -d \
+  -e AMQ_USER=admin \
+  -e AMQ_PASSWORD=admin \
+  -p 61616:61616 \
+  quay.io/artemiscloud/activemq-artemis-broker
+----
+
+Then start the IBM MQ broker:
+----
+docker run \
+  -d \
+  -e LICENSE=accept \
+  -e MQ_QMGR_NAME=QM1 \
+  -e MQ_APP_PASSWORD=passw0rd \
+  -p 1414:1414 \
+  icr.io/ibm-messaging/mq:9.3.2.1-r1
+----
+
+== 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.
+
+After the application is started, you can send messages to the IBMMQ queue using the rest endpoint `/message`:
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello World'
+----
+
+In the application logs you will see:
+
+----
+2023-10-11 08:10:52,782 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello World
+2023-10-11 08:10:52,903 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello World
+2023-10-11 08:10:52,927 INFO  [amq] (Camel (camel-4) thread #8 - JmsConsumer[in]) ActiveMQ received: Hello World
+----
+
+The message is initially dispatched to an IBMMQ queue, then relayed to an ActiveMQ queue, and ultimately retrieved from the ActiveMQ queue and printed to the log without any issues.
+
+=== Transaction rollback
+
+If you wish to illustrate a rollback, simply send a message containing the `rollback` keyword.
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello rollback'
+----
+The log could be divided into two segments. In this demonstration, the IBMMQ to ActiveMQ route is configured to simulate a transaction rollback following the dispatch of a message to the ActiveMQ queue. Due to the rollback, you'll notice that the message isn't fetched from the ActiveMQ queue and isn't logged:
+
+----
+2023-10-11 08:12:46,314 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello rollback
+2023-10-11 08:12:46,453 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello rollback
+2023-10-11 08:12:46,457 WARN  [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Transaction rollback (0xea2b886) redelivered(false) for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003) caught: Simulated rollback
+2023-10-11 08:12:46,458 ERROR [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Failed delivery for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003). Exhausted after delivery attempt: 1 caught: java.lang.RuntimeException: Simulated rollback
+...
+<truncated exception from the simulated rollback>
+----
+
+Because the transaction was rolled back, the message wasn't successfully processed and it is returned to the IBMMQ queue and subsequently redelivered. In this instance, the delivery is successful and logged accordingly:
+
+----
+2023-10-11 08:12:46,561 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Redelivering message after rollback to ActiveMQ: Hello rollback
+2023-10-11 08:12:46,567 INFO  [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Transaction commit (0xea2b886) redelivered(true) for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000004))
+2023-10-11 08:12:46,585 INFO  [amq] (Camel (camel-4) thread #8 - JmsConsumer[in]) ActiveMQ received: Hello rollback
+----
+
+In this example, a local file transaction storage is used, which is set up through the `quarkus.transaction-manager.object-store.directory` property. If you prefer to utilize a database for configuring the storage, please refer to the Quarkus transactions guide available at https://quarkus.io/guides/transaction#jdbcstore.
+
+=== Transaction recovery
+
+To trigger a JVM crash during the transaction, send a message containing the word `crash`.
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello rollback'

Review Comment:
   thanks, copy-paste error



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1360705615


##########
message-bridge/README.adoc:
##########
@@ -0,0 +1,206 @@
+= Message Bridge: A Camel Quarkus example
+:cq-example-description: An example that shows how to configure AMQ and IBM MQ clients to use the connection pooling and XA transactions.
+
+{cq-description}
+
+TIP: Check the https://camel.apache.org/camel-quarkus/latest/first-steps.html[Camel Quarkus User guide] for prerequisites
+and other general information.
+
+== Overview
+
+In this example, a basic REST endpoint is provided for users to dispatch a message to the IBM MQ queue. Subsequently, all messages from the IBM MQ are relayed to an ActiveMQ queue within an XA transaction. To showcase the transaction functionality, a message containing the keyword "rollback" will initiate a transaction rollback. To demonstrate the process of a transaction recovery after a crash, send a message with they keyword "crash".
+
+Details regarding client configurations can be located in the `src/main/resources/application.properties` file.
+
+== Prerequisites
+
+First start the ActiveMQ broker:
+----
+docker run \
+  -d \
+  -e AMQ_USER=admin \
+  -e AMQ_PASSWORD=admin \
+  -p 61616:61616 \
+  quay.io/artemiscloud/activemq-artemis-broker
+----
+
+Then start the IBM MQ broker:
+----
+docker run \
+  -d \
+  -e LICENSE=accept \
+  -e MQ_QMGR_NAME=QM1 \
+  -e MQ_APP_PASSWORD=passw0rd \
+  -p 1414:1414 \
+  icr.io/ibm-messaging/mq:9.3.2.1-r1
+----
+
+== 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.
+
+After the application is started, you can send messages to the IBMMQ queue using the rest endpoint `/message`:
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello World'
+----
+
+In the application logs you will see:
+
+----
+2023-10-11 08:10:52,782 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello World
+2023-10-11 08:10:52,903 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello World
+2023-10-11 08:10:52,927 INFO  [amq] (Camel (camel-4) thread #8 - JmsConsumer[in]) ActiveMQ received: Hello World
+----
+
+The message is initially dispatched to an IBMMQ queue, then relayed to an ActiveMQ queue, and ultimately retrieved from the ActiveMQ queue and printed to the log without any issues.
+
+=== Transaction rollback
+
+If you wish to illustrate a rollback, simply send a message containing the `rollback` keyword.
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello rollback'
+----
+The log could be divided into two segments. In this demonstration, the IBMMQ to ActiveMQ route is configured to simulate a transaction rollback following the dispatch of a message to the ActiveMQ queue. Due to the rollback, you'll notice that the message isn't fetched from the ActiveMQ queue and isn't logged:
+
+----
+2023-10-11 08:12:46,314 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: Hello rollback
+2023-10-11 08:12:46,453 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: Hello rollback
+2023-10-11 08:12:46,457 WARN  [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Transaction rollback (0xea2b886) redelivered(false) for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003) caught: Simulated rollback
+2023-10-11 08:12:46,458 ERROR [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Failed delivery for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000003). Exhausted after delivery attempt: 1 caught: java.lang.RuntimeException: Simulated rollback
+...
+<truncated exception from the simulated rollback>
+----
+
+Because the transaction was rolled back, the message wasn't successfully processed and it is returned to the IBMMQ queue and subsequently redelivered. In this instance, the delivery is successful and logged accordingly:
+
+----
+2023-10-11 08:12:46,561 INFO  [ibmmq-amq] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Redelivering message after rollback to ActiveMQ: Hello rollback
+2023-10-11 08:12:46,567 INFO  [org.apa.cam.jta.TransactionErrorHandler] (Camel (camel-4) thread #7 - JmsConsumer[DEV.QUEUE.1]) Transaction commit (0xea2b886) redelivered(true) for (MessageId: ID:414d5120514d312020202020202020206437266503e30040 on ExchangeId: 01C264F444F3A96-0000000000000004))
+2023-10-11 08:12:46,585 INFO  [amq] (Camel (camel-4) thread #8 - JmsConsumer[in]) ActiveMQ received: Hello rollback
+----
+
+In this example, a local file transaction storage is used, which is set up through the `quarkus.transaction-manager.object-store.directory` property. If you prefer to utilize a database for configuring the storage, please refer to the Quarkus transactions guide available at https://quarkus.io/guides/transaction#jdbcstore.
+
+=== Transaction recovery
+
+To trigger a JVM crash during the transaction, send a message containing the word `crash`.
+
+----
+curl -X POST -H "Content-Type: text/plain" http://localhost:8080/message -d 'Hello crash'
+----
+
+This will result in the JVM stopping abruptly:
+
+----
+2023-10-13 15:21:03,277 INFO  [ibmmq] (executor-thread-1) Sending message to IBMMQ: crash
+2023-10-13 15:21:03,429 INFO  [ibmmq-amq] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Sending message from IBMMQ to ActiveMQ: crash
+2023-10-13 15:21:03,449 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Preparing DummyXAResource
+2023-10-13 15:21:03,461 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Committing DummyXAResource
+2023-10-13 15:21:03,461 INFO  [org.acm.mes.bri.DummyXAResource] (Camel (camel-1) thread #1 - JmsConsumer[DEV.QUEUE.1]) Crashing the system
+----
+
+Upon restarting the application, after a few seconds you will observe that the transaction has been restored, and the message has been successfully delivered to the ActiveMQ broker.
+
+----
+2023-10-13 15:21:36,458 INFO  [io.quarkus] (main) camel-quarkus-examples-message-bridge 3.5.0-SNAPSHOT on JVM (powered by Quarkus 3.5.0.CR1) started in 0.893s. Listening on: http://0.0.0.0:8080
+2023-10-13 15:21:36,459 INFO  [io.quarkus] (main) Profile prod activated.
+2023-10-13 15:21:36,459 INFO  [io.quarkus] (main) Installed features: [artemis-jms, camel-attachments, camel-core, camel-direct, camel-jms, camel-jta, camel-platform-http, camel-rest, cdi, messaginghub-pooled-jms, narayana-jta, smallrye-context-propagation, vertx]
+2023-10-13 15:21:46,386 INFO  [org.acm.mes.bri.DummyXAResourceRecovery] (Periodic Recovery) DummyXAResourceRecovery returning list of resources: [org.acme.message.bridge.DummyXAResource@3739f1f4, org.acme.message.bridge.DummyXAResource@7d2113fb]
+2023-10-13 15:21:46,391 WARN  [com.arj.ats.jta] (Periodic Recovery) ARJUNA016037: Could not find new XAResource to use for recovering non-serializable XAResource XAResourceRecord < resource:null, txid:< formatId=131077, gtrid_length=35, bqual_length=36, tx_uid=0:ffffc0a80136:8e8b:65294417:31, node_name=quarkus, branch_uid=0:ffffc0a80136:8e8b:65294417:33, subordinatenodename=null, eis_name=0 >, heuristic: TwoPhaseOutcome.FINISH_OK com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord@1d57754e >
+2023-10-13 15:21:46,483 INFO  [org.acm.mes.bri.DummyXAResourceRecovery] (Periodic Recovery) DummyXAResourceRecovery returning list of resources: [org.acme.message.bridge.DummyXAResource@24a51dd0, org.acme.message.bridge.DummyXAResource@4fc1b14d]
+2023-10-13 15:21:46,484 WARN  [com.arj.ats.jta] (Periodic Recovery) ARJUNA016038: No XAResource to recover < formatId=131077, gtrid_length=35, bqual_length=36, tx_uid=0:ffffc0a80136:8e8b:65294417:31, node_name=quarkus, branch_uid=0:ffffc0a80136:8e8b:65294417:33, subordinatenodename=null, eis_name=0 >
+2023-10-13 15:21:46,485 INFO  [org.acm.mes.bri.DummyXAResource] (Periodic Recovery) Committing DummyXAResource
+2023-10-13 15:21:46,512 INFO  [amq] (Camel (camel-1) thread #2 - JmsConsumer[in]) ActiveMQ received: crash
+----
+
+You may observe the warning messages related to the XAResource recovery in the logs. This is a known issue related to how we simulate the crash of the system and can be ignored.
+
+=== 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]
+
+==== JVM mode
+
+[source,shell]
+----
+$ mvn clean package
+$ java -jar target/quarkus-app/quarkus-run.jar
+...
+[io.quarkus] (main) camel-quarkus-examples-... started in 1.163s.
+----
+
+=== Running on OpenShift
+
+You can also deploy this example as an OpenShift pod using the capabilities of the quarkus-maven-plugin.
+
+Before doing so, make sure to deploy the AMQ and IBMMQ brokers:
+
+----
+oc new-app quay.io/artemiscloud/activemq-artemis-broker -e AMQ_USER=admin -e AMQ_PASSWORD=admin
+oc patch service/activemq-artemis-broker -p '{"spec":{"ports":[{"name":"61616-tcp", "port": 61616, "protocol": "TCP", "targetPort": 61616}]}}'
+----
+
+----
+oc new-app icr.io/ibm-messaging/mq:9.3.2.1-r1 -e MQ_QMGR_NAME=QM1 -e LICENSE=accept -e MQ_APP_PASSWORD=passw0rd
+----
+
+Next, create a `PersistentVolumeClaim` to serve as the storage for the transaction manager's object store. This example assumes that a persistent volume claim named `message-bridge` has already been set up. Keep in mind that the configuration of the persistent volume may require adjustments based on your specific OpenShift setup:
+
+----
+oc create -f - <<EOF
+kind: PersistentVolumeClaim
+apiVersion: v1
+metadata:
+  name: message-bridge
+spec:
+  accessModes:
+    - ReadWriteOnce
+  resources:
+    requests:
+      storage: 1Gi
+EOF
+----
+
+Then deploy this example using the `openshift` profile specified within this project:
+
+----
+mvn clean package -DskipTests -Popenshift
+----
+
+Once the pod is up and running successfully, you can send messages in a manner similar to local deployment:
+
+----
+curl -X POST -H "Content-Type: text/plain" http://$(oc get route camel-quarkus-examples-message-bridge -o jsonpath='{.spec.host}')/message -d 'Hello world'
+----
+

Review Comment:
   Apart from that, the transaction recovery has also worked on a sandbox oc instance :clap: 



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng commented on PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#issuecomment-1766207131

   Great work @avano - I'm going to merge it. @jamesnetherton @aldettinger do you have anything to add?


-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1354730577


##########
message-bridge/pom.xml:
##########
@@ -0,0 +1,274 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<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>
+
+    <artifactId>camel-quarkus-examples-message-bridge</artifactId>
+    <groupId>org.apache.camel.quarkus.examples</groupId>
+    <version>3.5.0-SNAPSHOT</version>
+
+    <name>Camel Quarkus :: Examples :: Message Bridge</name>
+    <description>Camel Quarkus Example :: Configure XA Transactions and connection pooling</description>
+
+    <properties>
+        <quarkus.platform.version>3.4.1</quarkus.platform.version>
+        <camel-quarkus.platform.version>3.5.0-SNAPSHOT</camel-quarkus.platform.version>
+
+        <quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
+        <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
+        <camel-quarkus.platform.group-id>org.apache.camel.quarkus</camel-quarkus.platform.group-id>
+        <camel-quarkus.platform.artifact-id>camel-quarkus-bom</camel-quarkus.platform.artifact-id>
+
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <maven.compiler.target>17</maven.compiler.target>
+        <maven.compiler.source>17</maven.compiler.source>
+        <maven.compiler.testTarget>${maven.compiler.target}</maven.compiler.testTarget>
+        <maven.compiler.testSource>${maven.compiler.source}</maven.compiler.testSource>
+
+        <formatter-maven-plugin.version>2.23.0</formatter-maven-plugin.version>
+        <impsort-maven-plugin.version>1.9.0</impsort-maven-plugin.version>
+        <license-maven-plugin.version>4.2</license-maven-plugin.version>
+        <maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
+        <maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
+        <maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
+        <maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
+        <quarkus-artemis-jms.version>3.1.1</quarkus-artemis-jms.version>
+    </properties>
+
+    <dependencyManagement>
+        <dependencies>
+            <!-- Import BOM -->
+            <dependency>
+                <groupId>${quarkus.platform.group-id}</groupId>
+                <artifactId>${quarkus.platform.artifact-id}</artifactId>
+                <version>${quarkus.platform.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+            <dependency>
+                <groupId>${camel-quarkus.platform.group-id}</groupId>
+                <artifactId>${camel-quarkus.platform.artifact-id}</artifactId>
+                <version>${camel-quarkus.platform.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+        <!-- Camel -->
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-direct</artifactId>
+        </dependency>
+
+        <!-- REST endpoint -->
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-servlet</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-rest</artifactId>
+        </dependency>
+
+        <!-- Transactions -->
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-jta</artifactId>
+        </dependency>
+
+        <!-- Messaging -->
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-jms</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkiverse.messaginghub</groupId>
+            <artifactId>quarkus-pooled-jms</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.ibm.mq</groupId>
+            <artifactId>com.ibm.mq.jakarta.client</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkiverse.artemis</groupId>
+            <artifactId>quarkus-artemis-jms</artifactId>
+            <version>${quarkus-artemis-jms.version}</version>
+        </dependency>
+
+        <!-- Test -->
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-junit5</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-junit5</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <pluginManagement>
+            <plugins>
+
+                <plugin>
+                    <groupId>net.revelc.code.formatter</groupId>
+                    <artifactId>formatter-maven-plugin</artifactId>
+                    <version>${formatter-maven-plugin.version}</version>
+                    <configuration>
+                        <configFile>${maven.multiModuleProjectDirectory}/eclipse-formatter-config.xml</configFile>
+                        <lineEnding>LF</lineEnding>
+                    </configuration>
+                </plugin>
+
+                <plugin>
+                    <groupId>net.revelc.code</groupId>
+                    <artifactId>impsort-maven-plugin</artifactId>
+                    <version>${impsort-maven-plugin.version}</version>
+                    <configuration>
+                        <groups>java.,javax.,org.w3c.,org.xml.,junit.</groups>
+                        <removeUnused>true</removeUnused>
+                        <staticAfter>true</staticAfter>
+                        <staticGroups>java.,javax.,org.w3c.,org.xml.,junit.</staticGroups>
+                    </configuration>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-compiler-plugin</artifactId>
+                    <version>${maven-compiler-plugin.version}</version>
+                    <configuration>
+                        <showDeprecation>true</showDeprecation>
+                        <showWarnings>true</showWarnings>
+                        <compilerArgs>
+                            <arg>-Xlint:unchecked</arg>
+                        </compilerArgs>
+                    </configuration>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-surefire-plugin</artifactId>
+                    <version>${maven-surefire-plugin.version}</version>
+                    <configuration>
+                        <failIfNoTests>false</failIfNoTests>
+                        <systemProperties>

Review Comment:
   There is this warning:
   
   ```
   [WARNING]  Parameter 'systemProperties' is deprecated: Use systemPropertyVariables instead.
   ```
   
   This one mayb be solved like this:
   https://github.com/apache/camel-quarkus-examples/commit/589b7e3470ede35f2224b56eb3f5918bc00c8b87



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on code in PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#discussion_r1354488567


##########
message-bridge/pom.xml:
##########
@@ -0,0 +1,274 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<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>
+
+    <artifactId>camel-quarkus-examples-message-bridge</artifactId>
+    <groupId>org.apache.camel.quarkus.examples</groupId>
+    <version>3.5.0-SNAPSHOT</version>
+
+    <name>Camel Quarkus :: Examples :: Message Bridge</name>
+    <description>Camel Quarkus Example :: Configure XA Transactions and connection pooling</description>
+
+    <properties>
+        <quarkus.platform.version>3.4.1</quarkus.platform.version>
+        <camel-quarkus.platform.version>3.5.0-SNAPSHOT</camel-quarkus.platform.version>
+
+        <quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
+        <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
+        <camel-quarkus.platform.group-id>org.apache.camel.quarkus</camel-quarkus.platform.group-id>
+        <camel-quarkus.platform.artifact-id>camel-quarkus-bom</camel-quarkus.platform.artifact-id>
+
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <maven.compiler.target>17</maven.compiler.target>
+        <maven.compiler.source>17</maven.compiler.source>
+        <maven.compiler.testTarget>${maven.compiler.target}</maven.compiler.testTarget>
+        <maven.compiler.testSource>${maven.compiler.source}</maven.compiler.testSource>
+
+        <formatter-maven-plugin.version>2.23.0</formatter-maven-plugin.version>
+        <impsort-maven-plugin.version>1.9.0</impsort-maven-plugin.version>
+        <license-maven-plugin.version>4.2</license-maven-plugin.version>
+        <maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
+        <maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
+        <maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
+        <maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
+        <quarkus-artemis-jms.version>3.1.1</quarkus-artemis-jms.version>
+    </properties>
+
+    <dependencyManagement>
+        <dependencies>
+            <!-- Import BOM -->
+            <dependency>
+                <groupId>${quarkus.platform.group-id}</groupId>
+                <artifactId>${quarkus.platform.artifact-id}</artifactId>
+                <version>${quarkus.platform.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+            <dependency>
+                <groupId>${camel-quarkus.platform.group-id}</groupId>
+                <artifactId>${camel-quarkus.platform.artifact-id}</artifactId>
+                <version>${camel-quarkus.platform.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+        <!-- Camel -->
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-direct</artifactId>
+        </dependency>
+
+        <!-- REST endpoint -->
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-servlet</artifactId>

Review Comment:
   You can remove this as `camel-quarkus-rest` includes `camel-quarkus-platform-http`. 
   
   You can remove the servlet config from `application.properties` afterwards.



-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#issuecomment-1757531276

   Looks Narayana is doing the actual 2 Phase Commit under the hood. And as such, the transaction logs are stored in the `ObjectStore` folder. At least, it looks that way according to logs below:
   
   ```
   $ inotifywait -m -r .
   
   ./ObjectStore/ShadowNoFileLockStore/defaultStore/StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction/ CREATE 0_ffff7f000001_b517_65268954_1102
   ./ObjectStore/ShadowNoFileLockStore/defaultStore/StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction/ OPEN 0_ffff7f000001_b517_65268954_1102
   ./ObjectStore/ShadowNoFileLockStore/defaultStore/StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction/ MODIFY 0_ffff7f000001_b517_65268954_1102
   ./ObjectStore/ShadowNoFileLockStore/defaultStore/StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction/ CLOSE_WRITE,CLOSE 0_ffff7f000001_b517_65268954_1102
   ./ObjectStore/ShadowNoFileLockStore/defaultStore/StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction/ DELETE 0_ffff7f000001_b517_65268954_1102
   ```
   
   Is it worth to explicitly add a note in the `README.adoc` file to explain where the transaction logs are being persisted ?
   Folks may find this useful to know where the state is stored. For instance, when deploying to kubernetes, there could be a need to configure volume/pvc not to lose the state.
   
   Which by the way, introduce another question. Would it be useful in the future to maybe deploy this example to kubernetes ala [file-bindy-ftp](https://github.com/apache/camel-quarkus-examples/tree/main/file-bindy-ftp/src/main/kubernetes)... Maybe not priority, let see this in another pr.


-- 
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-unsubscribe@camel.apache.org

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


Re: [PR] [Messaging] Add IBMMQ-AMQ example [camel-quarkus-examples]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on PR #165:
URL: https://github.com/apache/camel-quarkus-examples/pull/165#issuecomment-1761092160

   Please can we add the `native` profile into `pom.xml` (I assume all of this stuff has native support?).
   
   Also, as we're using Docker, can we add a profile to skip tests on Windows. Like [this](https://github.com/apache/camel-quarkus-examples/blob/main/cluster-leader-election/pom.xml#L340-L350).


-- 
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-unsubscribe@camel.apache.org

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