【发布时间】:2022-08-02 17:26:21
【问题描述】:
我指定了一个面向块的处理的小任务。
<batch:step id=\"midxStep\" parent=\"stepParent\">
<batch:tasklet transaction-manager=\"transactionManager\">
<batch:chunk
reader=\"processDbItemReaderJdbc\"
processor=\"midxItemProcessor\"
writer=\"midxCompositeItemWriter\"
processor-transactional=\"false\"
reader-transactional-queue=\"false\"
skip-limit=\"${cmab.batch.skip.limit}\"
commit-interval=\"#{jobParameters[\'toProcess\']==T(de.axa.batch.ecmcm.cmab.util.CmabConstants).TYPE_POSTAUSGANG ? \'${consumer.global.pa.midx.commitSize}\' : \'${consumer.global.pe.midx.commitSize}\' }\"
cache-capacity=\"20\">
<batch:skippable-exception-classes>
<batch:include class=\"de.axa.batch.ecmcm.cmab.util.CmabProcessMidxException\" />
<batch:exclude class=\"java.lang.IllegalArgumentException\" />
</batch:skippable-exception-classes>
<batch:retryable-exception-classes>
<batch:include class=\"de.axa.batch.ecmcm.cmab.util.CmabTechnicalMidxException\" />
<batch:include class=\"de.axa.batch.ecmcm.cmab.util.CmabTechnicalException\" />
</batch:retryable-exception-classes>
<batch:retry-listeners>
<batch:listener ref=\"logRetryListener\"/>
</batch:retry-listeners>
<batch:listeners>
<batch:listener>
<bean id=\"midxProcessSkipListener\" class=\"de.axa.batch.ecmcm.cmab.core.batch.listener.CmabDbSkipListener\" scope=\"step\">
<constructor-arg index=\"0\" value=\"#{jobParameters[\'errorStatus\']}\" type=\"java.lang.String\"/>
</bean>
</batch:listener>
</batch:listeners>
</batch:chunk>
<batch:transaction-attributes isolation=\"SERIALIZABLE\" propagation=\"MANDATORY\" timeout=\"${cmab.jta.usertransaction.timeout}\"/>
<batch:listeners>
<batch:listener ref=\"midxStepListener\"/>
<batch:listener>
<bean id=\"cmabChunkListener\" class=\"de.axa.batch.ecmcm.cmab.core.batch.listener.CmabChunkListener\" scope=\"step\"/>
</batch:listener>
</batch:listeners>
</batch:tasklet>
</batch:step>
tasklet 使用 JtaTransaction 管理器(Atomikos,name=\"transactionManager\")运行。
现在我的问题:
这个事务管理器“委托”到块进程吗?
为什么我要问这个?如果我将事务属性(参见块)设置为传播级别“MANDATORY”,则块进程因没有可用事务的错误而中止。
因此它让我感到困惑,因为我认为 tasklet 事务规范意味着在这个 tasklet 事务中运行的块也是。
此外,我打算在具有多个 pod 的云系统中运行该应用程序。
进程 DbIemReaderJdbs 通过存储过程 ItemReader 从 PostgresDB 获取带有“FOR UPDATE SKIP LOCKED”的项目。
所以我的意图是运行洞块,也意味着读者,在一事务以阻止读取器结果集到其他 POD 进程。
标签: spring-batch