| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- package com.uas.search.console.controller;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.ResponseBody;
- import com.uas.search.console.jms.AQListener;
- import com.uas.search.console.service.IndexService;
- /**
- * 索引创建相关请求
- * @author sunyj
- * @since 2016年8月5日 上午11:42:54
- */
- @Controller
- @RequestMapping("/index")
- public class IndexController {
-
- @Autowired
- private IndexService indexService;
-
- @Autowired
- private AQListener aqListener;
-
- /**
- * 初始化创建索引文件
- *
- * @return 所用时间 ms
- */
- @RequestMapping("/create")
- @ResponseBody
- public String initIndexes() {
- return "Indexes created success in " + indexService.createIndexs() + " ms.";
- }
-
- /**
- * 实时更新索引
- * @return
- */
- @RequestMapping("/listen")
- @ResponseBody
- public String listen(){
- new Thread(){
- public void run() {
- aqListener.execute();
- };
- }.start();
- return "Listen...";
- }
- }
|