Coder Social home page Coder Social logo

alibaba / tac Goto Github PK

View Code? Open in Web Editor NEW
280.0 28.0 54.0 8.11 MB

The TAC (Tiny API Cloud) is a server-side solution with tangram. Of course, it also supports the use of secession from tangram; TAC is not a platform, nor a framework, but a development model.

License: MIT License

JavaScript 4.55% HTML 0.16% Vue 5.55% CSS 0.02% Java 89.72%
tangram tac micro-service

tac's Introduction

TAC

What is TAC ?

  • The TAC (Tiny API Cloud) is a server-side solution with tangram. Of course, it also supports the use of secession from tangram; TAC is not a platform, nor a framework, but a development model.

Features

  • Quick publish;
  • Without deploy;
  • Flexible modification
  • Quickly add data sources
  • Client developers directly participate in server-side logic;

Why TAC?

Before TAC

  • Before the birth of TAC, the development mode of most app server-side on Tmall app was like this. Take the home page as an example:
    • Client and server developer discuss the interface data types, fields;
    • The server developer provides a mock interface with parallel development at both ends.
    • Test, deploy, release.
  • The disadvantage of this model is that since the page relies on various data sources, publishing is a long process. If the field is modified, the entire application will be recompiled and packaged. The deployment process is too long; different pages are deployed in different applications. unable to share data source

After TAC

  • TAC access to various commonly used data sources;
  • Clients submit source code directly on TAC, compile, test, and publish;
  • Client development does not require the participation of server-side developer, eliminating the need for communication.
  • Server-side developer focus on developing business logic;

tac develop progress

Quick Start

Install redis

Run container

java -jar tac-container.jar

Run console

java -jar tac-console.jar --admin
  • open console when succes
http://localhost:7001/#/tacMs/list

Code Develop

        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>tac-sdk</artifactId>
            <version>${project.version}</version>
        </dependency>
  • Write your code
public class HelloWorldTac implements TacHandler<Object> {

    /**
     * 引入日志服务
     */
    private TacLogger tacLogger = TacInfrasFactory.getLogger();

    /**
     * 编写一个实现TacHandler接口的类
     *
     * @param context
     * @return
     * @throws Exception
     */

    @Override
    public TacResult<Object> execute(Context context) throws Exception {

        // 执行逻辑
        tacLogger.info("Hello World");

        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);
    }
}

compile and package

cd tac-dev-source
java -jar tac-console.jar --package --msCode=helloworld

Pre-Publish

  • Pre-Publish

  • Test-Pre-Publish

Online-Publish

  • online check
curl  http://localhost:8001/api/tac/execute/helloworld -s|json
  • Result
{
  "success": true,
  "msgCode": null,
  "msgInfo": null,
  "data": {
    "helloworld": {
      "data": {
        "name": "hellotac",
        "clientVersion": "7.0.2",
        "userName": "tac-userName",
        "platform": "iPhone"
      },
      "success": true,
      "msCode": "helloworld"
    }
  },
  "hasMore": null,
  "ip": "127.0.0.1"
}

tac's People

Contributors

ljinshuan avatar mikeafc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tac's Issues

数据源多个版本的冲突问题 & jar使用框架引起的问题

问题一:能否兼容数据源的多个版本?
目前存在这样一个问题:
jar-A依赖于数据源db0.3版本。
jab-B依赖于数据源db0.4版本。

从db0.3--0.4的升级过程中。
某些接口实现发生了变化,或者返回值发生变化。

extend-libs放入db0.3和db0.4两个版本。(实际好像是有一个会生效)

测试中发现,jar-A和jar-B中不能指定到具体版本。只有一个结果会正确。

问题二:
jar使用spring boot或者 guava等来进行注入操作, 我们的container如何进行解析?

maven打包到tac-engine不动了

在tac目录下mvn clean package到tac-engine启动了springboot,显示启动成功然后就不动了。从文档上没找到打包相关问题,是我姿势不对吗?请指导一下,谢谢!
最后输出
2018-11-15 10:48:26.156 INFO 13708 --- [ main] c.a.tac.test.redis.StringDataRedisTest : Starting StringDataRedisTest on iz2ze6yg9gdtue5w51f15lz with PID 13708 (started by root in /root/tac/tac-engine) 2018-11-15 10:48:26.157 INFO 13708 --- [ main] c.a.tac.test.redis.StringDataRedisTest : No active profile set, falling back to default profiles: default 2018-11-15 10:48:26.183 INFO 13708 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@6cdba6dc: startup date [Thu Nov 15 10:48:26 CST 2018]; root of context hierarchy 2018-11-15 10:48:27.832 INFO 13708 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode! 2018-11-15 10:48:28.280 INFO 13708 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 2018-11-15 10:48:29.804 INFO 13708 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 2147483647 2018-11-15 10:48:29.899 INFO 13708 --- [ main] c.a.tac.test.redis.StringDataRedisTest : Started StringDataRedisTest in 4.72 seconds (JVM running for 6.401) testSub1

关于项目应用场景的一些疑惑

1 目前项目在阿里巴巴内部的使用情况如何?
之前看天猫和淘宝廉价版上面有使用。
2 tac本身的场景是哪些?
我的理解是,目前更偏向于对聚合层服务,进行服务编排,本身不能很重。
如果增加数据库,rpc等的调用,会增加整体的复杂度,甚至导致tac不可用。
3 本身采用自定义classloader方式加载类,使用上会有一定局限性。
第一,需要让使用方指定哪些是tac可以做的,哪些不能做,这个比较难阐述。
第二,目前客户端集成sdk后,只能对应一个URL,这样客户端本身拆解的过于零散,代码重复过多。
第三,classloader,目前不支持动态添加方法,变量,这样必须重启。

有点疑问

这是一个让客户端开发人员去定义接口字段,接口ID的一个模式?客户端人员写好了一个mock接口,服务端的开发就把自己的数据对接到这个接口,是这个意思吗?

ConsoleApplication.java中有段代码重复

if (!webEnv) {
// command model
springApplication.setAdditionalProfiles(additionProfile);
} else {
// web model
springApplication.setAdditionalProfiles(additionProfile);
}
这里配置在上面已经按环境区分了,这里设置代码重复了。

这个是我姿势不对嘛~~

F:\Projects\JAVA\tac\tac-dev-source> java -jar ..\tac-console\target\tac-console-0.0.4.jar --package --msCode=helloworld
12:06:00.015 [main] DEBUG com.alibaba.tac.console.ConsoleApplication - the temp tac lib folder:C:\Users\LIXUNH~1\AppData\Local\Temp\com.alibaba.tac-spring-boot-libs
2018-05-28 12:06:00.753  INFO 8200 --- [           main] c.a.tac.console.ConsoleApplication       : Starting ConsoleApplication v0.0.4 on lxh with PID 8200 (F:\Projects\JAVA\tac\tac-console\target\tac-console-0.0.4.jar started by LiXunHuan in F:\Projects\JAVA\tac\tac-dev-source)
2018-05-28 12:06:00.757  INFO 8200 --- [           main] c.a.tac.console.ConsoleApplication       : The following profiles are active: simple

测试问题

你好,问一下 预发布测试的时候入参怎么传?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.