分布式任务调度框架Temporal介绍
所属分类 temporal
浏览量 1083
分布式任务调度
Elastic-Job XXL-Job Quartz
Temporal
the open source platform for orchestrating highly reliable, mission-critical applications at scale
orchestrate 编排
SDKs (Java go php ...)
Write Workflows and Activities, run Workers and embed Temporal Clients in your applications.
Temporal Cluster
Dev Tools (webUI tctl )
Tools to manage Workflow Execution lifecycles, manage your Cluster, debug your application, and more.
The Temporal CLI (tctl) is a command-line tool that you can use to interact with a Temporal Cluster.
It can perform Namespace operations (such as register, update, and describe)
and Workflow operations (such as start Workflow, show Workflow History, and Signal Workflow).
几种角色
Activity Workflow Workers TemporalServer CLI Web SDK
Activity 一段可运行代码(function) 不限制开发语言 提供了各种语言的SDK
Workflow Activity的集合,多个Activity可以构成一个Workflow,调度的最小单位
Workers 不同语言写的Workflow 注册到对应语言的Worker中,Worker是代码的真正执行者
Temporal server 管理注册到自己的Workers,向Workers下发任务,监听任务状态等
CLI or SDK 任务的发起者、监控任务进度等
Web 负责任务的监控、查询等
CLI or SDK 负责启动某个Workflow
Temporal server 把请求调度到某个Worker
Worker 负责执行任务
Activity 限制很少
Workflow 不建议和外部系统交互(读写文件 访问网络)等
定时任务
周期性任务
延时任务
延时1小时向用户发送短信和邮件
编写Activity代码
编写Workflow 代码
启动 Worker
启动 TemplateServer
发起任务
// 连接到 Temporal Server,注册自己
c, err := client.NewClient(client.Options{})
w := worker.New(c, app.TaskQueue, worker.Options{})
w.RegisterWorkflow(app.SendMessageWorkflow)
w.RegisterActivity(app.SendMessage)
w.RegisterActivity(app.SendEmail)
// Start listening to the Task Queue
err = w.Run(worker.InterruptCh())
参考资料
Server Intro
https://docs.temporal.io/docs/server/introduction
Temporal Core Concepts
https://docs.temporal.io/docs/temporal-explained/introduction
https://docs.temporal.io/docs/concepts/
Temporal architecture deep dive
https://docs.temporal.io/blog/workflow-engine-principles/
https://github.com/temporalio/temporal
https://docs.temporal.io/
上一篇
下一篇
scala shell 使用第三方jar包
sbt hello 例子
gradle入门
Temporal 架构简介
Temporal 本地环境搭建及测试
分布式任务调度一些技术点