rabbit / data-pipeline
rabbit data pipeline
1.0.0
2020-06-19 07:02 UTC
Requires
- rabbit/framework: ^1.0
- rabbit/httpclient: ^1.0
- rabbit/parser: ^1.0
- rabbit/server: ^1.0
This package is auto-updated.
Last update: 2024-12-30 09:07:08 UTC
README
- 基于插件的流程处理组件
组件配置
return [ 'scheduler' => [ '{}' => Scheduler::class, '()' => [ [ '{}' => YamlParser::class, '()' => [ App::getAlias('@yaml') ] ] ], 'senders' => arrdef([ 'worker' => definition(WorkerSender::class), 'process' => definition(ProcessSender::class) ]), 'cron' => definition('cron') ] ];
任务配置
lock: task lock time,default null cron: crontab or int,default null.int is later sec, -1 is only run once
通用配置
type: Plugin Class String start: true|false output: Plugin Name errHandler: callable
type
插件完整类名start
是否开始插件,默认false
output
输出到下一个插件,支持Http
输出到远程插件,worker
多进程任务,格式PluginName String|(http|worker):address:PluginName String
,默认不等待['PluginName String|(http|worker):address:PluginName String':true|false|int]
- PS:
true
启用协程等待,不设超时;int
启用协程等待,值为超时时间;false
不等待
errHandler
错误处理函数
内置插件
Sources
Common
TransForms
Sinks
插件开发
- 继承
AbstractPlugin
- 实现
run
函数 - 通过
init
从$this->config
中获取配置参数初始化配置属性 - 插件间传值通过
Message
类,开启协程传递需要clone Message
,输出值赋值到克隆的Message->data
属性 - PS:配置属性禁止在运行过程中修改,插件为单例模式,协程环境下会造成属性污染。可使用局部变量替代,例如
$name=$this->name
,使用$name