Open-Cache

一个可监控的分布式缓存系统,我们的目标是做一个企业级的分布式缓存产品,让缓存数据的管理更方便,让缓存数据的监控更直观,让每一位用户上手更简单。

🍪 快速开始

1 搭建任务管理系统

  1. 创建数据库表

sql 文件在 doc/db/open_job.sql

  1. 启动 Dashboard 服务
@EnableSecurity
@EnableScheduling
@EnableOpenRpcClient
@SpringBootApplication
public class JobDashboardApplication {

    public static void main(String[] args) {
        SpringApplication.run(JobDashboardApplication.class, args);
    }
}
  1. 启动执行器
@EnableOpenRpcServer
@SpringBootApplication
public class JobClientApplication {

    public static void main(String[] args) {
        SpringApplication.run(JobClientApplication.class, args);
    }
}
  1. 下载前端项目
git clone https://github.com/lijunping365/Open-Job-Admin.git
  1. 安装依赖
npm install
  1. 启动前端项目
npm start

2 创建 JobHandler

示例 1

@Slf4j
@JobHandler(name = "job-one")
@Component
public class OpenJobHandlerOne implements OpenJobHandler {

    @Override
    public void handler(JobParam jobParam) {
        log.info("JobHandlerOne 处理任务");
    }
}

示例 2

@Slf4j
@Component
public class OpenJobHandlerMethodOne{

    @JobHandler(name = "job-method-one1")
    public void handlerOne1(JobParam jobParam) {
        log.info("JobHandlerOne 处理任务, 任务参数 {}", jobParam.getParams());
    }

    @JobHandler(name = "job-method-one2")
    public void handlerOne2(JobParam jobParam) {
        log.info("JobHandlerOne 处理任务, 任务参数 {}", jobParam.getParams());
    }
}