Bladeren bron

和kafka redis 链接成功,正式开始测业务

wuxw7 8 jaren geleden
bovenliggende
commit
72805d4ea6

+ 1 - 0
.gitignore

@@ -22,4 +22,5 @@
 hs_err_pid*
 
 .idea
+logs
 *.iml

+ 1 - 1
CenterService/src/main/java/com/java110/center/CenterServiceApplicationStart.java

@@ -19,7 +19,7 @@ import org.springframework.web.client.RestTemplate;
  * @date 2016年8月6日
  * @tag
  */
-@SpringBootApplication(scanBasePackages={"com.java110.service","com.java110.order","com.java110.core","com.java110.event.center"})
+@SpringBootApplication(scanBasePackages={"com.java110.service","com.java110.center","com.java110.core","com.java110.event.center","com.java110.cache"})
 @EnableDiscoveryClient
 //@EnableConfigurationProperties(EventProperties.class)
 public class CenterServiceApplicationStart {

+ 16 - 7
CenterService/src/main/resources/application.yml

@@ -4,8 +4,8 @@ jedis:
       maxTotal: 100
       maxIdle: 20
       maxWaitMillis: 20000
-    host: 127.0.0.1
-    port: 3306
+    host: 192.168.31.199
+    port: 6379
 
 eureka:
   client:
@@ -16,13 +16,23 @@ server:
 spring:
   application:
     name: center-service
+  redis:
+    database: 0
+    host: 192.168.31.199
+    port: 6379
+    pool:
+      max-active: 8
+      max-wait: -1
+      max-idle: 8
+      min-idle: 0
+      timeout: 0
 
 #============== kafka ===================
 kafka:
   consumer:
     zookeeper:
-      connect: 10.93.21.21:2181
-    servers: 10.93.21.21:9092
+      connect: 192.168.31.199:2181
+    servers: 192.168.31.199:9092
     enable:
       auto:
         commit: true
@@ -39,11 +49,10 @@ kafka:
     concurrency: 10
 
   producer:
-    servers: 10.93.21.21:9092
+    servers: 192.168.31.199:9092
     retries: 0
     batch:
       size: 4096
     linger: 1
     buffer:
-      memory: 40960
-
+      memory: 40960

+ 1 - 0
CommonService/src/main/java/com/java110/base/dao/impl/CommonServiceDaoImpl.java

@@ -31,6 +31,7 @@ public class CommonServiceDaoImpl extends BaseServiceDao implements ICommonServi
     @Cacheable(key= "CodeMappingAll")
     public List<CodeMapping> getCodeMappingAll() throws Exception{
        Jedis jedis = jedisPool.getResource();
+
        List<CodeMapping> codeMappings = null;
        if(jedis.exists("CodeMappingAll".getBytes())){
            codeMappings = SerializeUtil.unserializeList(jedis.get("CodeMappingAll".getBytes()),CodeMapping.class);

+ 1 - 1
java110-cacheAgent/src/main/java/com/java110/cache/RedisConfiguration.java

@@ -15,7 +15,7 @@ import redis.clients.jedis.JedisPoolConfig;
 @Configuration
 public class RedisConfiguration extends CachingConfigurerSupport  {
 
-    @Bean(name= "jedis.pool")
+    @Bean(name= "jedisPool")
     @Autowired
     public JedisPool jedisPool(@Qualifier("jedis.pool.config") JedisPoolConfig config,
                                @Value("${jedis.pool.host}")String host,

+ 1 - 1
java110-common/src/main/java/com/java110/common/cache/BaseCache.java

@@ -11,7 +11,7 @@ import redis.clients.jedis.JedisPool;
 public class BaseCache {
 
     protected static Jedis getJedis(){
-        JedisPool jedisPool = (JedisPool) ApplicationContextFactory.getBean("jedis.pool");
+        JedisPool jedisPool = (JedisPool) ApplicationContextFactory.getBean("jedisPool");
         return jedisPool.getResource();
     }
 

+ 1 - 1
java110-config/src/main/resources/config/center_event.properties

@@ -4,4 +4,4 @@ java110.event.properties.centerServiceListener=\
 
 java110.event.properties.centerServiceEvent=\
   save.userService.userInfo::com.java110.event.center.user.event.DataFlowCustEvent,\
-  save.merchantService.merchantInfo::com.java110.event.center.user.event.DataFlowMerchantEvent
+  save.merchantService.merchantInfo::com.java110.event.center.merchant.event.DataFlowMerchantEvent

+ 4 - 3
java110-config/src/main/resources/logback.xml

@@ -4,9 +4,9 @@
 
 
     <appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <File>./logs/app.log</File>
+        <File>logs/app.log</File>
         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/info-%d{yyyyMMdd}.log.%i</fileNamePattern>
+            <fileNamePattern>logs/info-%d{yyyyMMdd}.log.%i</fileNamePattern>
             <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                 <maxFileSize>500MB</maxFileSize>
             </timeBasedFileNamingAndTriggeringPolicy>
@@ -22,7 +22,7 @@
         <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
             <level>ERROR</level>
         </filter>
-        <File>${LOG_PATH}/error.log</File>
+        <File>logs/error.log</File>
         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
             <fileNamePattern>${LOG_PATH}/error-%d{yyyyMMdd}.log.%i
             </fileNamePattern>
@@ -39,4 +39,5 @@
     </appender>
 
     <logger name="org.springframework.web" level="INFO_FILE"/>
+    <logger name="com.java110" level="INFO_FILE"/>
 </configuration>

+ 10 - 9
java110-core/src/main/java/com/java110/core/base/dao/BaseServiceDao.java

@@ -21,7 +21,8 @@ import java.util.logging.Logger;
 public class BaseServiceDao extends AppBase {
 
     @Autowired
-   protected JedisPool jedisPool;
+    protected JedisPool jedisPool;
+
 
     @Autowired
    protected SqlSessionTemplate sqlSessionTemplate;
@@ -35,14 +36,6 @@ public class BaseServiceDao extends AppBase {
         this.sqlSessionTemplate = sqlSessionTemplate;
     }
 
-    public JedisPool getJedisPool() {
-        return jedisPool;
-    }
-
-    public void setJedisPool(JedisPool jedisPool) {
-        this.jedisPool = jedisPool;
-    }
-
     private final static String SERVICE_CASE_JSON_EXCEPTION = "101";//转json异常
 
     /**
@@ -106,4 +99,12 @@ public class BaseServiceDao extends AppBase {
         }
         return reqMap;
     }
+
+    public JedisPool getJedisPool() {
+        return jedisPool;
+    }
+
+    public void setJedisPool(JedisPool jedisPool) {
+        this.jedisPool = jedisPool;
+    }
 }