camunda获取异步任务的加锁机制
2021-02-12 本文已影响0人
zoengyunhing
<select id="selectNextJobsToExecute" parameterType="org.camunda.bpm.engine.impl.db.ListQueryParameterObject" resultMap="jobResultMap">
<bind name="orderingProperties" value="parameter.orderingProperties" />
<include refid="org.camunda.bpm.engine.impl.persistence.entity.Commons.bindOrderBy"/>
${limitBefore}
select
RES.* ${limitBetween}
from ${prefix}ACT_RU_JOB RES
where (RES.RETRIES_ > 0)
and (RES.DUEDATE_ is null or RES.DUEDATE_ <= #{parameter.now, jdbcType=TIMESTAMP})
and (RES.LOCK_OWNER_ is null or RES.LOCK_EXP_TIME_ < #{parameter.now, jdbcType=TIMESTAMP})
and RES.SUSPENSION_STATE_ = 1
<if test="parameter.deploymentAware">
and (RES.DEPLOYMENT_ID_ is null
<if test="parameter.deploymentIds != null">
or
RES.DEPLOYMENT_ID_ in
<foreach item="deploymentId" index="index" collection="parameter.deploymentIds"
open="(" separator="," close=")">
#{deploymentId}
</foreach>
</if>
)
</if>
<if test="parameter.applyOrdering">
${orderBy}
</if>
${limitAfter}
</select>