From e050a2ab2fa176ebd0d2461681a41df34838c028 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期三, 07 六月 2023 11:11:17 +0800
Subject: [PATCH] add comment
---
java110-core/src/main/java/com/java110/core/event/cmd/ServiceCmdEventPublishing.java | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/java110-core/src/main/java/com/java110/core/event/cmd/ServiceCmdEventPublishing.java b/java110-core/src/main/java/com/java110/core/event/cmd/ServiceCmdEventPublishing.java
index add6586..2267805 100644
--- a/java110-core/src/main/java/com/java110/core/event/cmd/ServiceCmdEventPublishing.java
+++ b/java110-core/src/main/java/com/java110/core/event/cmd/ServiceCmdEventPublishing.java
@@ -110,6 +110,7 @@
*/
public static void multicastEvent(ICmdDataFlowContext cmdDataFlowContext) throws Exception {
Assert.notNull(cmdDataFlowContext.getServiceCode(), "褰撳墠娌℃湁鍙鐞嗙殑涓氬姟淇℃伅锛�");
+ //todo 鏍规嵁cmd serviceCode 鍙戝竷浜嬩欢
multicastEvent(cmdDataFlowContext.getServiceCode(), cmdDataFlowContext, null);
}
@@ -132,8 +133,10 @@
*/
public static void multicastEvent(String serviceCode, ICmdDataFlowContext dataFlowContext, String asyn) throws Exception {
try {
+ //todo 缁勮浜嬩欢
CmdEvent targetDataFlowEvent = new CmdEvent(serviceCode, dataFlowContext);
+ //todo 鍙戝竷浜嬩欢
multicastEvent(serviceCode, targetDataFlowEvent, asyn);
} catch (Exception e) {
logger.error("鍙戝竷渚﹀惉澶辫触锛屽け璐ュ師鍥犱负锛�", e);
@@ -151,6 +154,7 @@
* @param asyn A 琛ㄧず寮傛澶勭悊
*/
public static void multicastEvent(String serviceCode, final CmdEvent event, String asyn) throws Exception {
+ //todo 鏍规嵁serviceCode 鍘诲鎵� 澶勭悊鐨凜md澶勭悊绫� 濡傛灉java绫讳腑 @Java110Cmd(serviceCode = "xx.xx") 鍐欎簡璇ユ敞瑙e氨浼氳瀵绘壘鍒�
List<ServiceCmdListener> listeners = getListeners(serviceCode);
//杩欓噷鍒ゆ柇 serviceCode + httpMethod 鐨勪睛鍚紝濡傛灉娌℃湁娉ㄥ唽鐩存帴鎶ラ敊銆�
if (listeners == null || listeners.size() == 0) {
@@ -159,7 +163,7 @@
}
for (final ServiceCmdListener listener : listeners) {
- if (CommonConstant.PROCESS_ORDER_ASYNCHRONOUS.equals(asyn)) { //寮傛澶勭悊
+ if (CommonConstant.PROCESS_ORDER_ASYNCHRONOUS.equals(asyn)) { //todo 寮傛澶勭悊,涓�鑸緢灏戠敤
Executor executor = getTaskExecutor();
executor.execute(new Runnable() {
@@ -174,6 +178,7 @@
});
break;
} else {
+ // todo 閫氳繃鍚屾鐨勬柟寮忚皟鐢–MDjava绫�
invokeListener(listener, event);
break;
}
@@ -192,7 +197,7 @@
}
/**
- * Invoke the given listener with the given event.
+ * 鎵ц 鏍规嵁serviceCode 鎵惧埌鐨刢md 绫�
*
* @param listener the ApplicationListener to invoke
* @param event the current event to propagate
@@ -201,15 +206,17 @@
@SuppressWarnings({"unchecked", "rawtypes"})
protected static void invokeListener(ServiceCmdListener listener, CmdEvent event) throws Exception {
try {
- // //杩欓噷澶勭悊涓氬姟閫昏緫鏁版嵁
+ //todo 鑾峰彇 cmd 涓婁笅鏂囧璞�
ICmdDataFlowContext dataFlowContext = event.getCmdDataFlowContext();
- //鑾峰彇璇锋眰鏁版嵁
+ //todo 鑾峰彇璇锋眰鏁版嵁
JSONObject reqJson = dataFlowContext.getReqJson();
logger.debug("API鏈嶅姟 --- 璇锋眰鍙傛暟涓猴細{}", reqJson.toJSONString());
+ //todo 璋冪敤 cmd鐨勬牎楠屾柟娉�
listener.validate(event, dataFlowContext, reqJson);
+ //todo 璋冪敤 cmd鐨勪笟鍔″鐞嗘柟娉�
listener.doCmd(event, dataFlowContext, reqJson);
//logger.debug("API鏈嶅姟 --- 杩斿洖鎶ユ枃淇℃伅锛歿}", dataFlowContext.getResponseEntity());
--
Gitblit v1.8.0