update(REQ-2516) - 添加一些伪代码

This commit is contained in:
wangli 2024-05-27 17:00:03 +08:00
parent 86679f3240
commit 2c20b69cb9
10 changed files with 104 additions and 3 deletions

View File

@ -16,7 +16,9 @@
- 内部与工作流的数据交互,也将异步解耦,确保在调用对端服务时,不会因为对端服务中止而失败。
- 接口需要有分类:
1. 部分接口仅支持同步调
2. 大部分接口支持同步和异步调用,异步调用则是利用 MQ 进行触发
2. 大部分接口支持同步和异步调用,
- 异步调用则是利用 MQ 进行触发
- 同步调用则是扫API包后根据注解为某些接口生成 Feign 的代理类,而非让自动生成 Feign 代理类
3. 接口需要有调用限制的控制,并非搜有的使用方均可直接调用
4. 针对同步调用设计支持回调接口,供使用方自行处理
- 内部将主动监听 MQ 队列,避免因为顺序消费从而导致的队列阻塞。

View File

@ -20,6 +20,8 @@ public class WorkflowEngineProperties {
*/
private Boolean localConsumer = false;
private Boolean autoAck = false;
public Boolean getManageable() {
return manageable;
}
@ -35,4 +37,12 @@ public class WorkflowEngineProperties {
public void setLocalConsumer(Boolean localConsumer) {
this.localConsumer = localConsumer;
}
public Boolean getAutoAck() {
return autoAck;
}
public void setAutoAck(Boolean autoAck) {
this.autoAck = autoAck;
}
}

View File

@ -0,0 +1,10 @@
package cn.axzo.workflow.starter.listener;
/**
* TODO
*
* @author wangli
* @since 2024/5/27 16:25
*/
public interface MessageNotificationListener {
}

View File

@ -0,0 +1,10 @@
package cn.axzo.workflow.starter.listener;
/**
* TODO
*
* @author wangli
* @since 2024/5/27 16:25
*/
public interface ProcessActivityListener {
}

View File

@ -0,0 +1,19 @@
package cn.axzo.workflow.starter.listener;
/**
* TODO
*
* @author wangli
* @since 2024/5/27 16:20
*/
public interface ProcessInstanceListener extends ProcessListener {
void created();
void completed();
void deleted();
void created();
}

View File

@ -0,0 +1,16 @@
package cn.axzo.workflow.starter.listener;
/**
* TODO
*
* @author wangli
* @since 2024/5/27 16:26
*/
public interface ProcessListener {
/**
* 入参来源于配置
*
* @param auto
*/
void ack(Boolean auto);
}

View File

@ -0,0 +1,10 @@
package cn.axzo.workflow.starter.listener;
/**
* TODO
*
* @author wangli
* @since 2024/5/27 16:21
*/
public interface ProcessTaskListener {
}

View File

@ -20,4 +20,6 @@ public class InnerActivityEventListener {
ProcessActivityEventEnum.PROCESS_ACTIVITY_TAKE.getEventCode(),
ProcessActivityEventEnum.PROCESS_ACTIVITY_END.getEventCode()
);
}

View File

@ -2,6 +2,7 @@ package cn.axzo.workflow.starter.mq.broadcast.consumer;
import cn.axzo.framework.rocketmq.Event;
import cn.axzo.workflow.common.enums.ProcessMessagePushEventEnum;
import cn.axzo.workflow.starter.listener.MessageNotificationListener;
import com.google.common.collect.ImmutableList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -15,7 +16,7 @@ import java.util.List;
* @since 2024/5/21 15:53
*/
public class InnerNoticeEventListener {
private final Logger log = LoggerFactory.getLogger(InnerNoticeEventListener.class);
private final static Logger log = LoggerFactory.getLogger(InnerNoticeEventListener.class);
public final static List<Event.EventCode> SUPPORTED_EVENT_CODES = ImmutableList.of(
ProcessMessagePushEventEnum.PROCESS_PUSH_NOTICE.getEventCode(),
ProcessMessagePushEventEnum.PROCESS_PUSH_PENDING.getEventCode(),
@ -25,4 +26,24 @@ public class InnerNoticeEventListener {
ProcessMessagePushEventEnum.PROCESS_CARBON_COPY_COMPLETE.getEventCode(),
ProcessMessagePushEventEnum.PROCESS_PUSH_SMS.getEventCode()
);
public static void main(String[] args) {
MessageNotificationListener listener = new MessageNotificationListener() {
public int hashCode() {
return super.hashCode();
}
};
try {
// 最后业务节点的 started 事件业务再做一个事情
listener.hashCode();
// trigger 最后一个节点
log.error("");
} catch (Exception e) {
// 这个地方应该配置项业务需要阻塞忽略
throw new RuntimeException(e);
}
}
}

View File

@ -1,5 +1,6 @@
package cn.axzo.workflow.starter.service.impl;
import cn.axzo.workflow.starter.listener.ProcessListener;
import cn.axzo.workflow.starter.mq.retry.producer.RpcInvokeEventProducer;
/**
@ -12,6 +13,6 @@ import cn.axzo.workflow.starter.mq.retry.producer.RpcInvokeEventProducer;
* @author wangli
* @since 2024/5/22 10:55
*/
public interface AsynchronousService {
public interface AsynchronousService extends ProcessListener {
}