From bf47d41dddf76c58a41692e492014499f9d433ae Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期五, 09 八月 2019 23:13:48 +0800
Subject: [PATCH] 服务绑定 及 代码生成器开发测试完成
---
java110-event/src/main/java/com/java110/event/center/init/EventConfigInit.java | 43 ++-----------------------------------------
1 files changed, 2 insertions(+), 41 deletions(-)
diff --git a/java110-event/src/main/java/com/java110/event/center/init/EventConfigInit.java b/java110-event/src/main/java/com/java110/event/center/init/EventConfigInit.java
index 7da1db3..14611b9 100644
--- a/java110-event/src/main/java/com/java110/event/center/init/EventConfigInit.java
+++ b/java110-event/src/main/java/com/java110/event/center/init/EventConfigInit.java
@@ -1,14 +1,11 @@
package com.java110.event.center.init;
import com.java110.common.factory.ApplicationContextFactory;
-import com.java110.event.app.AppEventPublishing;
import com.java110.event.center.DataFlowEventPublishing;
-import com.java110.event.center.DataFlowListener;
-import org.apache.commons.lang3.StringUtils;
+import com.java110.event.center.listener.DataFlowListener;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.support.PropertiesLoaderUtils;
-import javax.naming.ConfigurationException;
import java.util.Properties;
/**
@@ -33,10 +30,6 @@
*/
private final static String DATAFLOW_LISTENER = "java110.event.properties.centerServiceListener";
- /**
- * 璁㈠崟璋冨害浜嬩欢
- */
- private final static String DISPATCH_EVENT = "java110.event.properties.centerServiceEvent";
public static void initSystemConfig(){
@@ -46,9 +39,6 @@
Properties properties = load(DEFAULT_EVENT_PATH,DEFAULT_FILE_NAME);
registerListener(properties);
-
- //娉ㄥ唽浜嬩欢
- registerEvent(properties);
}
catch (Exception ex) {
@@ -77,42 +67,13 @@
String[] listeners = properties.getProperty(DATAFLOW_LISTENER).split("\\,");
for(String listener : listeners){
-
- //杩欓噷涓嶈兘鐩存帴鍙嶅皠锛岃繖鏍� IXXXService 鏃犳硶娉ㄥ叆锛屾墍浠ョ洿鎺ヤ粠spring 涓幏鍙栧凡缁忔敞鍏ョ殑
- DataFlowListener<?> dataFlowListener = (DataFlowListener<?>) ApplicationContextFactory.getBean(listener);
-
//灏� listener 鏀惧叆 AppEventPublishing 涓柟渚垮悗鏈熸搷浣�
//娉ㄥ唽渚﹀惉
- DataFlowEventPublishing.addListenner(dataFlowListener);
+ DataFlowEventPublishing.addListener(listener);
}
}
- /**
- * 娉ㄥ唽浜嬩欢
- * @param properties
- * @throws Exception
- */
- private static void registerEvent(Properties properties) throws Exception{
- String[] events = properties.getProperty(DISPATCH_EVENT).split("\\,");
- for (String event : events){
-
- if(StringUtils.isBlank(event) || !event.contains("::")){
- throw new ConfigurationException("閰嶇疆閿欒锛孾"+DISPATCH_EVENT+"= "+events+"] 褰撳墠 [event = "+event+"],涓嶅瓨鍦� :: ,閰嶇疆鏍煎紡涓� A::B");
- }
-
- String[] tmpEvent = event.split("::");
-
- if(tmpEvent.length > 2){
- throw new ConfigurationException("閰嶇疆閿欒锛孾"+DISPATCH_EVENT+"= "+events+"] 褰撳墠 [event = "+event+"],鍙兘鏈変竴涓� :: ,閰嶇疆鏍煎紡涓� A::B");
- }
-
- Class clazz = Class.forName(tmpEvent[1]);
-
- AppEventPublishing.addEvent(tmpEvent[0],clazz);
- }
-
- }
}
--
Gitblit v1.8.0