Carry actual flow state and freeze callback round identity
Local review candidate only. Explicitly selected inherited prerequisites and prior repair patches; unrelated WIP and independent MQ fixes are excluded. No push or deployment authorized.
This commit is contained in:
@@ -120,6 +120,10 @@ public class CallbackDispatcher {
|
||||
if (event.getData() != null) {
|
||||
data.putAll(event.getData());
|
||||
}
|
||||
// 身份在事件发布线程中冻结,不能用 AFTER_COMMIT 重读到的新轮给旧事件重新贴标。
|
||||
if (event.getRoundIdentity() != null) {
|
||||
data.putAll(event.getRoundIdentity());
|
||||
}
|
||||
payload.put("data", data);
|
||||
String payloadJson = objectMapper.writeValueAsString(payload);
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.yunhai.flowcenter.callback;
|
||||
|
||||
import com.yunhai.flowcenter.engine.FlowEvent;
|
||||
import com.yunhai.flowcenter.repository.FlwInstanceRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/** 同步发布阶段冻结轮次身份;不修改引擎或 apply/v2 七支分支。 */
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class FlowEventIdentityListener {
|
||||
private final FlwInstanceRepository instances;
|
||||
|
||||
@EventListener
|
||||
@Order(Ordered.HIGHEST_PRECEDENCE)
|
||||
public void capture(FlowEvent event) {
|
||||
instances.findById(event.getInstanceId()).ifPresent(instance ->
|
||||
event.captureRoundIdentity(instance.getApplyRound(), instance.getApplyRequestToken()));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user