第三方系统调用etl-engineetl-crontab暴露Http/Https API接口
第三方系统可通过Http/Https方式调用上述接口运行etl-engine
etl-engine运行HttpInput节点实现阻塞模式
第三方系统可通过Http/Https方式向etl-engine提交数据
etl-engine运行MQ消费者节点实现阻塞模式
第三方系统可通过MQ生产者向etl-engine发送消息数据

根据对应标签名称去实现相应的接口,如上所述标签名称:
<BeforeOut/> <AfterOut/> <BeforeRun/>
脚本内包名称格式固定
package ext
根据实际需要引入常用工具包
import ( "errors" "fmt" "strconv" "time" "github.com/tidwall/gjson" "github.com/tidwall/sjson" "etl-engine/etl/tool/extlibs/common" )
实现对应的接口
func RunScript() (result bool, topErr error) {
fmt.Println("common.GlobalVar.Vint:",common.GlobalVar.Vint)
if ( common.GlobalVar.Vint < 8 ){
fmt.Println("返回false")
return false,nil
}else{
fmt.Println("返回true")
return true,nil
}
}
1. 公共变量的生命周期作用于每个etl-engine任务运行开始到运行结束之间。
2. 引入包 "etl-engine/etl/tool/extlibs/common"
3. 该包所提供的公共变量
- GlobalVar
Vint int64
Vbool bool
Vstring string
Vfloat float64
Vmap map[string]string
Vinteface interface{}
ViArray []int64
VsArray []string
VbArray []bool
VfArray []float64
4. 脚本中调用公共变量
common.GlobalVar.Vint = common.GlobalVar.Vint + 1
fmt.Println("common.GlobalVar.Vint:",common.GlobalVar.Vint)
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70024931/viewspace-2929319/ ,如需转载,请注明出处,否则将追究法律责任。