Skip to content

Latest commit

 

History

History
116 lines (74 loc) · 2.52 KB

ide_source_start.md

File metadata and controls

116 lines (74 loc) · 2.52 KB

源码启动详细步骤

  • 以下以 idea 为例,描述 tac 源码从 idea 启动步骤

代码拉取

git clone [email protected]:alibaba/tac.git

打开工程

  • 项目通过 springboot 编写 依赖 jdk1.8
  • 使用了 lombok 包,idea 需要安装 lombok 插件;

undefined

安装并启动 redis (本地默认配置)

  • ip : 127.0.0.1
  • port : 6379

启动 console

  • com.alibaba.tac.console.ConsoleApplication 带上 --admin 参数启动

undefined

新建服务

undefined

编写代码

  • 参考 tac-dev-source

undefined

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

上传 jar 包

undefined

预发布

预发布测试

undefined

正式发布

运行

  • com.alibaba.tac.container.ContainerApplication

控制台操作发布

undefined