非事务性出站如何与 Mule 中的事务性入站一起工作 [英] How does a non transactional outbound work with a transactional inbound in Mule

查看:53
本文介绍了非事务性出站如何与 Mule 中的事务性入站一起工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

事务管理 主题下的 Mule 文档中,有一个隐晦的段落

In the Mule documentation under the transaction management topic there is a cryptic paragraph

Mule 可以管理非事务性出站连接器.默认情况下,来自非事务性传输的出站连接器会忽略活动事务而不是拒绝它.换句话说,此类连接器的默认事务操作不再是 NONE.下面的示例代码说明了这种行为.Mule 以同步和事务方式处理它从 VM 队列接收到的消息.代码示例中的文件传输不是事务性的,因此写入文件不是事务的一部分.但是,如果在 Mule 创建文件时消息抛出异常,Mule 会回滚事务并重新处理消息.这个例子实际上是一个多资源事务.

Mule can manage non-transactional outbound connectors. By default, an outbound connector from a non-transactional transport ignores an active transaction rather than rejecting it. In other words, the default transactional action for such connectors is no longer NONE. The example code below illustrates this behavior. Mule processes messages it receives from the VM queue synchronously and transactionally. The file transport in the code example is not transactional thus, writing to the file is not part of the transaction. However, if a message throws an exception while Mule is creating the file, Mule rolls back the transaction and reprocesses the message. This example is, in effect, a multiple resource transaction.

下面这句话是什么意思,是不是笔误(不再是NONE)?如果它不是 NONE 那么事务操作是什么?

What does the below sentence mean, is it a typo (no longer NONE)? and if its not NONE then what is the transactional action?

换句话说,此类连接器的默认事务操作不再是 NONE

In other words, the default transactional action for such connectors is no longer NONE

另外,如果写入文件不是事务的一部分,那么如果文件写入失败,如何回滚事务??

Also if writing into the file is not part of the transaction, then how can the transaction be rolled back if the file write fails ??

推荐答案

这不是打字错误.

以前,它曾经是NONE,因此事务的解析独立于非事务性出站交互的结果.现在,事务没有被解析,即非事务的出站端点不提交或回滚当前事务.

Previously, it used to be NONE, so the transaction was resolved independently of the outcome of the non-transactional outbound interaction. Nowadays, the transaction is not resolved, ie the non-transacted outbound endpoint doesn't commit or rollback the current transaction.

发生回滚是因为抛出了异常,将事务标记为要回滚.当流程终止时,当前事务就会被解决.如果已经标记回滚,则回滚,否则提交.

The rollback occurs because an exception is thrown, which marks the transaction as to be rolled back. When the flow terminates, the current transaction is then resolved. If it has been marked for roll back, it will be rolled-back, otherwise it will be committed.

这篇关于非事务性出站如何与 Mule 中的事务性入站一起工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆