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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]