Giter VIP home page Giter VIP logo

cloud-func's Introduction

cloud-func

云函数

啥意思

通过socket连接的方式调用java的方法,实现远程调用,是不是还挺有意思的!

如何使用

// 先写一个供远程调用的函数,然后使用注解标识它,比如这样
@Register("fun")
public class RemoteFunc {
    @Register
    public String add(String a, String b) {
        return a + b;
    }
}
// 实例化云函数服务,然后在云函数服务类中注册这个函数
public class ServerTest {
    public static void main(String[] args) {
        RemoteFunc remoteFunc = new RemoteFunc();
        CftpServer cftpServer = new CftpServer();
        // 注册
        cftpServer.getCftpContext().registerObj(remoteFunc);
        // 启动云函数
        cftpServer.start();
    }
}

怎么远程调用呢

  1. 每个类会有自己的groupName与methodName标识,调用遵循
groupName methodName param1 param2
  1. 测试一下
# 启动云函数服务 见单元测试ServerTest.java
# telnet连接云函数服务 默认端口8080
telnet localhost 8080
# 输入指令
cftp help

cloud-func's People

Contributors

calebman avatar unprepared avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

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.