feat: add outbound WCS retry dispatch

This commit is contained in:
zgw
2026-07-16 10:02:45 +08:00
parent aa6728e52b
commit 9158a5fa54
18 changed files with 845 additions and 91 deletions

View File

@@ -60,6 +60,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where job_id = #{jobId}
and version_no = #{versionNo}
and dispatch_status in ('PENDING', 'BLOCKED', 'RETRY_WAIT', 'EXHAUSTED', 'SENDING')
and (dispatch_status != 'SENDING'
or last_attempt_time <= dateadd(minute, -5, #{attemptTime}))
and (#{trigger} != 'AUTO_RETRY' or auto_retry_count < 5)
</update>
@@ -67,27 +69,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update wcs_job_dispatch
set dispatch_status = 'BLOCKED', last_error = #{lastError}, next_retry_time = #{nextRetryTime},
update_time = #{updateTime}, version_no = version_no + 1
where job_id = #{jobId} and dispatch_status != 'SUCCESS'
where job_id = #{jobId}
and version_no = #{versionNo}
and dispatch_status != 'SUCCESS'
</update>
<update id="markRetryWait" parameterType="map">
update wcs_job_dispatch
set dispatch_status = 'RETRY_WAIT', last_error = #{lastError}, next_retry_time = #{nextRetryTime},
update_time = #{updateTime}, version_no = version_no + 1
where job_id = #{jobId} and dispatch_status = 'SENDING'
where job_id = #{jobId}
and version_no = #{versionNo}
and dispatch_status = 'SENDING'
</update>
<update id="markSuccess" parameterType="map">
update wcs_job_dispatch
set dispatch_status = 'SUCCESS', last_error = null, next_retry_time = null,
success_time = #{successTime}, update_time = #{successTime}, version_no = version_no + 1
where job_id = #{jobId} and dispatch_status = 'SENDING'
where job_id = #{jobId}
and version_no = #{versionNo}
and dispatch_status = 'SENDING'
</update>
<update id="markExhausted" parameterType="map">
update wcs_job_dispatch
set dispatch_status = 'EXHAUSTED', last_error = #{lastError}, next_retry_time = null,
update_time = #{updateTime}, version_no = version_no + 1
where job_id = #{jobId} and dispatch_status = 'SENDING'
where job_id = #{jobId}
and version_no = #{versionNo}
and dispatch_status in ('SENDING', 'BLOCKED', 'RETRY_WAIT')
</update>
</mapper>