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_ &gt; 0)
      and (RES.DUEDATE_ is null or RES.DUEDATE_ &lt;= #{parameter.now, jdbcType=TIMESTAMP})
      and (RES.LOCK_OWNER_ is null or RES.LOCK_EXP_TIME_ &lt; #{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>
上一篇 下一篇

猜你喜欢

热点阅读