操纵XA资源的顺序
有没有办法操纵Quarkus交易中执行注册的Xaresources的顺序? 在我的情况下,我在配置的XA事务中有一个数据库数据库和一个ActiveMQ资源。对我来说,似乎没有定义的顺序首先处理哪种资源,哪些资源在两阶段竞争期间持续。
我的问题是,有时最终提交首先是对消息系统进行的,因此服务A的事件在数据库完成之前发布了最终提交 - 该事件由另一个服务B处理,该事件试图从服务A中获取数据 - 在极少数情况下,服务b从服务出版之前的服务A接收数据A,在DB上的两阶段命令的最终提交仍在进行中。
IMO最好的解决方案是将ActiveMQ资源始终作为两阶段委托中的第二(或最后一个)资源。
Is there a way to manipulate the order of executing the registered XAResources within a transaction for quarkus?
In my scenario I have a database datasource and an ActiveMQ resource within the XA transaction configured. For me it seems that there is no defined order which resource is handled first and which last during the two-phase-commit.
My issue is that sometimes the final commit is done first to the messaging system, so that event of service A is published before the database has finished it's final commit - the event is handled by another service B that tries to fetch data from service A - in rare cases service B receives data from service A that is of state before event publishing cause final commit of two-phase-commit on db is still in progress.
IMO the best solution would be to handle the ActiveMQ resource always as second (or last) resource within the two-phase-commit.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从Thorntail迁移后,我们正在经历相同的问题。似乎Narayana(Quarkus使用的事务管理器)不支持按照此(尽管旧)“ noreferrer”> thread在JBOSS社区档案中。评论的作者指出,可以通过实施
org.jboss.tm.firstresource
的资源来完成订购,但我们尚未尝试过。我们目前的解决方案是通过
_AMQ_SCHED_DELIVERY
在JMS消息上使用延迟,以在消耗消息之前给出足够的DB提交时间。We're experiencing the same issues after migrating from Thorntail. It seems Narayana (transaction manager that is used by Quarkus) does not support ordering as per this (albeit old) thread on JBoss Community Archive. The author of the comment states that ordering can be done by resource implementing the
org.jboss.tm.FirstResource
but we have not tried that yet.Our solution for now is using a delay via
_AMQ_SCHED_DELIVERY
property on JMS message to give DB enough time to commit before the message is consumed.