Authored by Zhao

add zk get

@@ -56,6 +56,7 @@ public class RecallStrategyLogicService { @@ -56,6 +56,7 @@ public class RecallStrategyLogicService {
56 String configStr = ""; 56 String configStr = "";
57 try { 57 try {
58 configStr = JsonUtil.toJson(list); 58 configStr = JsonUtil.toJson(list);
  59 + LOGGER.info("publish recall strategy data " + configStr + " to zk");
59 zkConfigService.addStringValueToZk(RECALL_STRATEGY_CONFIGKEY, configStr); 60 zkConfigService.addStringValueToZk(RECALL_STRATEGY_CONFIGKEY, configStr);
60 } catch (Exception e) { 61 } catch (Exception e) {
61 LOGGER.error("publish recall strategy data " + configStr + " to zk failed!", e); 62 LOGGER.error("publish recall strategy data " + configStr + " to zk failed!", e);
@@ -2,6 +2,7 @@ package com.yoho.search.consumer.test; @@ -2,6 +2,7 @@ package com.yoho.search.consumer.test;
2 2
3 import com.yoho.search.consumer.index.increment.bulks.CommonBulkService; 3 import com.yoho.search.consumer.index.increment.bulks.CommonBulkService;
4 import com.yoho.search.consumer.job.CleanDataJob; 4 import com.yoho.search.consumer.job.CleanDataJob;
  5 +import com.yoho.search.consumer.service.logicService.RecallStrategyLogicService;
5 import com.yoho.search.dal.SknImageVectorsMapper; 6 import com.yoho.search.dal.SknImageVectorsMapper;
6 import org.slf4j.Logger; 7 import org.slf4j.Logger;
7 import org.slf4j.LoggerFactory; 8 import org.slf4j.LoggerFactory;
@@ -80,4 +81,15 @@ public class TestApiController { @@ -80,4 +81,15 @@ public class TestApiController {
80 // JSONObject jsonObject = new JSONObject(indexData); 81 // JSONObject jsonObject = new JSONObject(indexData);
81 // commonBulkService.add(new ESBluk(jsonObject.toJSONString(), skn, "images_test", "images_test", false)); 82 // commonBulkService.add(new ESBluk(jsonObject.toJSONString(), skn, "images_test", "images_test", false));
82 // } 83 // }
  84 +
  85 +
  86 + @Autowired
  87 + private RecallStrategyLogicService recallStrategyLogicService;
  88 +
  89 + @RequestMapping(value = "/test2")
  90 + @ResponseBody
  91 + public String test2() {
  92 + String result = recallStrategyLogicService.getRecallStrategyConfigInZk();
  93 + return result;
  94 + }
83 } 95 }