English 中文(简体)
春 Bat按草原处理战略的滚动机制
原标题:rollback mechanism for chunk oriented processing strategy of Spring Batch

我们都知道,春季批量自2.0版以来,使用以草原为导向的处理方法。

Does it mean that, if an exception occurs in the item writer, the Data Source Transaction manager will roll back the whole chunk or only the related item?

实际上,我给了它一个尝试,并且看到框架翻开了整个空白。 这不是我需要的,因为我不想,我要说,499件成功处理的项目,在最后一件事造成一个例外的情况下,由500件物品组成的棚户中转播。

我能够找到的唯一解决办法是,在我的任务中增加以下内容。 然而,我不清楚这是否正确。

<batch:transaction-attributes propagation="NOT_SUPPORTED"/> 

另一种意见是,简单地将草地面积缩小到1(一个),但也有一点意义。

Maybe Spring Batch不适合我的问题领域。 如果是的话,请告诉我,那么,我就在奋起与这种框架具体行为作斗争。

任何建议都将受到高度赞赏。

问题回答

你们的权利:整个草地都得到支持。

我面临同样的问题,并做了以下工作:

  • adapt the batch size according to the database (I was using batch statement to save my updates). 25 was a good value for us: better than 1 (batch benefits), not too much (huge transactions).
  • relaunch this step a limited times : we enabled re-executing this task 3 times maximum.

之所以如此,是因为在批量处理过程中可能会发生更正(德国马克公司所作的更正)。

在进程结束时,所有标明失败和重新使用3次的数据被明确标明为我们的批量报告中的失败:然后需要人改正或特殊程序。

The solution might be to stop propagating the exception in writer and catch it. This will prevent batch from rolling back as you catch the exception and do your custom handling.

你可以在作者方法中以预告方式进行不同的交易。 REQUIRES_NEW处理这一使用案件。





相关问题
WCF Transaction Flow Question

I would like to configure WCF service operations to accept a transaction if my client sends one, but not to create one if none is sent. I think this would be similar to the Supported transaction ...

question about pl/sql exception

the following text is an excerpt of oracle documentation Oracle® Database PL/SQL Language Reference 11g Release 1 (11.1) : Unhandled exceptions can also affect subprograms. If you exit a ...

SQL Server - transactions roll back on error?

We have client app that is running some SQL on a SQL Server 2005 such as the following: BEGIN TRAN; INSERT INTO myTable (myColumns ...) VALUES (myValues ...); INSERT INTO myTable (myColumns ...) ...

Cannot rollback transaction with Entity Framework

I have to do queries on uncommitted changes and I tried to use transactions, but I found that it do not work if there are exceptions. I made a simple example to reproduce the problem. I have a ...

mySQL - Prevent double booking

I am trying to work out the best way to stop double booking in my application. I have a table of unique id s each can be sold only once. My current idea is to use a transaction to check if the ...

热门标签