- 以下以 idea 为例,描述 tac 源码从 idea 启动步骤
git clone [email protected]:alibaba/tac.git
- 项目通过 springboot 编写 依赖 jdk1.8
- 使用了 lombok 包,idea 需要安装 lombok 插件;
- ip : 127.0.0.1
- port : 6379
- com.alibaba.tac.console.ConsoleApplication 带上 --admin 参数启动
package com.alibaba.tac.biz.processor;
import com.alibaba.tac.sdk.common.TacResult;
import com.alibaba.tac.sdk.domain.Context;
import com.alibaba.tac.sdk.factory.TacInfrasFactory;
import com.alibaba.tac.sdk.handler.TacHandler;
import com.alibaba.tac.sdk.infrastracture.TacLogger;
import java.util.HashMap;
import java.util.Map;
/**
* @author jinshuan.li
*/
public class HelloWorldTac implements TacHandler<Object> {
/**
* get the logger service
*/
private TacLogger tacLogger = TacInfrasFactory.getLogger();
/**
* implement a class which implements TacHandler interface
* {@link TacHandler}
* @param context
* @return
* @throws Exception
*/
@Override
public TacResult<Object> execute(Context context) throws Exception {
// the code
tacLogger.info("Hello World22");
Map<String, Object> data = new HashMap<>();
data.put("name", "hellotac");
data.put("platform", "iPhone");
data.put("clientVersion", "7.0.2");
data.put("userName", "tac-userName");
return TacResult.newResult(data);
}
}
cd tac-dev-source
mvn clean -Dmaven.test.skip=true package
- com.alibaba.tac.container.ContainerApplication