kuiper-8-分享-function插件报错

本次的目标时build echo.go为插件,并在rule中使用它。
在执行到“创建规则”时出现错误: plugin.Open("/usr/local/kuiper-0.1-linux-x86_64/plugins/functions/Echo.so"): plugin was built with a different version of package internal/cpu

具体操作流程如下:

编写.go文件

直接使用echo.go这个示例文件,不加修改

build为插件

因为用go get命名获取了github上的kuiper项目,所以echo.go位于$gopath/src/github.com/emqx/kuiper/plugins/functions/echo.go路径下,build为.so文件:

go build --buildmode=plugin -o plugins/functions/Echo.so plugins/functions/echo.go

编写rule文件

在kuiper安装目录下创建如下文件
ruleechoo.txt

{
  "sql": "SELECT echo(temperature) from demoecho",
  "actions": [
    {
      "log": {}
    }]
}

开始测试

  1. 启动kuiper
bin/server
  1. 创建规则rule
bin/cli create rule ruleecho -f ruleecho.txt

执行这一步时报错:
Parse SQL SELECT echo(temperature) from demoecho error: cannot open /usr/local/kuiper-0.1-linux-x86_64/plugins/functions/Echo.so: plugin.Open("/usr/local/kuiper-0.1-linux-x86_64/plugins/functions/Echo.so"): plugin was built with a different version of package internal/cpu (previous failure).
在这里插入图片描述

查看rule,已经创建好了
在这里插入图片描述

启用rule,仍然报错:
在这里插入图片描述
暂时忽略错误,继续执行

  1. 创建流stream
bin/cli create stream demoecho '(temperature bigint) WITH (FORMAT="JSON", DATASOURCE="echo")'
  1. mosquitto发送数据
mosquitto_pub -h localhost -t "echoo" -m "{\"temperature\":30}"
  1. 查看stream.log,没有收到消息
    在这里插入图片描述
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值