Giter VIP home page Giter VIP logo

gxtimer's Introduction

GxTimer

1、定时回调系统

设计意图

  • 尝试型、定时调用第三方接口。
  • 实时、保障型通知第三方。

使用方法

请求内容

  • 定时补偿任务、实时通知的请求格式是application/json
class GxTimerRequest{
    String appId;
    String jobId;
    int reqType;
    int dataType;
    long timeUsed; /**需要尝试的时长,单位秒,0 采用系统默认的时长**/
    String reqUrl;
    String cbUrl;
    String reqBody;
    String reqHeader;
}

响应的内容格式,也是application/json

class GxTimerResponse{
    String appId;
    String jobId;
    int    status; /**200 成功,其他的失败**/
    String msg;    /**失败原因**/
}
  • 回调给调用方的请求也是application/json
class GxTimeCbRequest{
    String appId;
    String jobId;
    int    status; /**200 成功,其他的失败**/
    String msg;    /**失败原因**/
    String body;   /**第三方返回的内容**/
}

关键设计

  • 可靠尝试 采用指数退避算法,避免请求风暴。
  • 采用异步方式,单节点执行,双节点冗余。
  • 利用时间增量,进行任务轮询,定时任务执行时间间隔是1秒。

gxtimer's People

Contributors

zhiyu2018 avatar

Stargazers

 avatar

Watchers

James Cloos avatar  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.