<small id='2wGDF'></small><noframes id='2wGDF'>

<i id='2wGDF'><tr id='2wGDF'><dt id='2wGDF'><q id='2wGDF'><span id='2wGDF'><b id='2wGDF'><form id='2wGDF'><ins id='2wGDF'></ins><ul id='2wGDF'></ul><sub id='2wGDF'></sub></form><legend id='2wGDF'></legend><bdo id='2wGDF'><pre id='2wGDF'><center id='2wGDF'></center></pre></bdo></b><th id='2wGDF'></th></span></q></dt></tr></i><div id='2wGDF'><tfoot id='2wGDF'></tfoot><dl id='2wGDF'><fieldset id='2wGDF'></fieldset></dl></div>
    <bdo id='2wGDF'></bdo><ul id='2wGDF'></ul>

  • <tfoot id='2wGDF'></tfoot>

    <legend id='2wGDF'><style id='2wGDF'><dir id='2wGDF'><q id='2wGDF'></q></dir></style></legend>
      1. 以 IBM MQ 和 Oracle 为资源的独立 Spring 应用程序

        时间:2023-08-21
        1. <i id='rK3xh'><tr id='rK3xh'><dt id='rK3xh'><q id='rK3xh'><span id='rK3xh'><b id='rK3xh'><form id='rK3xh'><ins id='rK3xh'></ins><ul id='rK3xh'></ul><sub id='rK3xh'></sub></form><legend id='rK3xh'></legend><bdo id='rK3xh'><pre id='rK3xh'><center id='rK3xh'></center></pre></bdo></b><th id='rK3xh'></th></span></q></dt></tr></i><div id='rK3xh'><tfoot id='rK3xh'></tfoot><dl id='rK3xh'><fieldset id='rK3xh'></fieldset></dl></div>
          <tfoot id='rK3xh'></tfoot>

            <tbody id='rK3xh'></tbody>

            1. <small id='rK3xh'></small><noframes id='rK3xh'>

              • <legend id='rK3xh'><style id='rK3xh'><dir id='rK3xh'><q id='rK3xh'></q></dir></style></legend>

                  <bdo id='rK3xh'></bdo><ul id='rK3xh'></ul>
                • 本文介绍了以 IBM MQ 和 Oracle 为资源的独立 Spring 应用程序 XA 事务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在开发一个独立的 Apache camel 应用程序(不在 J2EE 容器上运行).此应用程序需要能够在分布式事务中将消息从 IBM MQ 队列管理器路由到 Oracle 数据库.我的谷歌搜索几乎把我带到了几个地方,但没有一个能给我一些关于如何把所有东西放在一起的好线索.下面的这个链接是最接近我需要的,但不幸的是它不够清晰,无法让我走上正确的道路.

                  I am in the process of developing a stand alone Apache camel application (not running on a J2EE container). This apps needs to be capable of routing messages from an IBM MQ queue manager to an Oracle database in a distributed transaction. My google searches pretty much took me to a few places but none of those were able to give me some good clues about how to put everything together. This link below was the closest to what I need but unfortunately it is not cler enough to put me on the right path.

                  IBM MQManager 作为 XA 事务使用 Spring-jms 和 Spring-tx 的经理

                  预先感谢您的意见.

                  推荐答案

                  您将需要使用 JTA TransactionManager,但由于不在 j2ee 容器中,我建议使用 Atomikos.

                  You will need to use a JTA TransactionManager, but since not being in a j2ee container i would sugest to use Atomikos.

                  https://github.com/camelinaction/camelinaction/tree/master/第9章/xa

                  我的路线是使用 IBM MQ -> Oracle 数据库,在 J2EE 中是的,但仍然应该使用 Atomikos 设置.我会说这不是正确的方法,但这是我设法让它工作的唯一方法 - 对于我的用例来说工作得很好.

                  My route which is working with IBM MQ -> Oracle Database, in an J2EE yes but still should be working with Atomikos setup. I would say this isn't the proper way to to it, but it's the only way I managed to get it working - working well enough for my use case.

                  from(inQueue)
                      .transacted()
                      .setHeader("storeData", constant(false))
                      .to("direct:a")
                      .choice().when(header("storeData").isEqualTo(false)) // if this is true the database calls are 'successful'
                      .log("Sending message to errorQueue")
                      .to(errorQueue)
                  ;
                  
                  StoreDataBean storeDataBean = new StoreDataBean();
                  from("direct:a")
                      .onException(Exception.class).handled(false).log("Rollbacking database changes").markRollbackOnlyLast().end()
                      .transacted("PROPAGATION_REQUIRES_NEW")
                      .bean(storeDataBean) //storeData sets the header storeData to true if no SQLException or other exceptions are thrown
                      .end()
                  ;
                  

                  提交是由事务管理器处理的,所以如果我真的收到数据库提交错误,它应该回滚消息.我在回滚消息方面遇到的下一个问题是我无法像使用 ActiveMQ 一样设置 deadLetterQueue.所以它回滚到传入队列.因此,我实际上像我一样处理数据库事务,它在一个新事务中,如果调用数据库时出现正常的 SQLException,则回滚该事务.

                  The commit are handled by the transaction manager, so if I actually get an error with the database commit, it should rollback the message. Next problem that I have had with rollbacking messages is that I can't set the deadLetterQueue, as you can with ActiveMQ. So it rolls back to the incoming queue. Therefore I actually handle the database transaction as I do, it is in a new transaction, which is rollbacked in case of a normal SQLException when calling the database.

                  我希望这有效:

                  from(inQueue)
                      .onException(Exception.class).to(errorQueue).markRollbackOnly().end()
                      .bean(storeDataBean)
                      .end()
                  

                  我已在社区论坛上发布了有关此内容的帖子,但根本没有任何答案.

                  I have posted about this in the community forums but no answers at all.

                  这篇关于以 IBM MQ 和 Oracle 为资源的独立 Spring 应用程序 XA 事务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:二进制文件到 SQL 数据库 Apache Camel 下一篇:Camel JDBC StreamList 查询似乎在拆分之前加载整个结

                  相关文章

                  最新文章

                  1. <small id='qKZWV'></small><noframes id='qKZWV'>

                    • <bdo id='qKZWV'></bdo><ul id='qKZWV'></ul>

                      <i id='qKZWV'><tr id='qKZWV'><dt id='qKZWV'><q id='qKZWV'><span id='qKZWV'><b id='qKZWV'><form id='qKZWV'><ins id='qKZWV'></ins><ul id='qKZWV'></ul><sub id='qKZWV'></sub></form><legend id='qKZWV'></legend><bdo id='qKZWV'><pre id='qKZWV'><center id='qKZWV'></center></pre></bdo></b><th id='qKZWV'></th></span></q></dt></tr></i><div id='qKZWV'><tfoot id='qKZWV'></tfoot><dl id='qKZWV'><fieldset id='qKZWV'></fieldset></dl></div>
                      <tfoot id='qKZWV'></tfoot>
                      <legend id='qKZWV'><style id='qKZWV'><dir id='qKZWV'><q id='qKZWV'></q></dir></style></legend>