测试demo 来自官方例子

使用docker-compose 进行运行

nats docker-compose file

version: '3.3'
services:
nats:
image: nats
ports:
- "4222:4222"
- "8222:8222"
- "6222:6222"

benthos stream 配置

参考 https://github.com/Jeffail/benthos/tree/master/resources/docker/streams

  • 整体说明
    里面的例子就是数据从文件读取到nats 之后不同的消费者进行nats 消息消费,再到webhook,webhook 标准输出

  • 文件读取说明

    读取文件,之后到nats

input:
type: read_until
read_until:
condition:
type: static
static: false
input:
type: file
file:
path: ./sample.json
restart_input: true
pipeline:
processors:
- type: throttle
throttle:
period: 3s
output:
type: nats
nats:
subject: benthos_messages
urls:
- nats://localhost:4222
  • nats 消费者(三个)
input:
type: nats
nats:
subject: benthos_messages
urls:
- nats://localhost:4222
pipeline:
processors:
- type: filter
filter:
type: jmespath
jmespath:
query: |
keys(@) | contains(@, 'title')
output:
type: http_client
http_client:
url: http://localhost:4195/webhooks/post/customer1
verb: POST
  • webhook 配置
input:
type: broker
broker:
inputs:
- type: http_server
http_server:
path: /post/customer1
processors:
- type: text
text:
operator: prepend
value: "Customer 1 received: "
- type: http_server
http_server:
path: /post/customer2
processors:
- type: text
text:
operator: prepend
value: "Customer 2 received: "
- type: http_server
http_server:
path: /post/customer3
processors:
- type: text
text:
operator: prepend
value: "Customer 3 received: "
output:
type: stdout

运行

  • docker-compose
dokcer-compose up -d
  • 启动benthos,基于文件stream 配置
benthos --streams --streams-dir ./configs

运行效果


修改sample.json 测试

参考资料

https://github.com/Jeffail/benthos/tree/master/resources/docker/streams

 
 
 
 

benthos stream nats 集成试用的更多相关文章

  1. streamsets 集成 rabbitmq 以及benthos stream 处理框架

    benthos 是一个stream 处理框架,streamsets 也是,但是两者可以通过不同的工具进行集成起来 一般我们可以使用http 服务,消息中间件(kafka.rabbitmq ...) 使 ...

  2. benthos stream 处理工具说明

    benthos 是golang 编写的流处理工具,同时也可以作为一个类库使用,当前支持的source sink 还是比较全的 (kafka rabbitmq http service s3 redis ...

  3. pushpin Server-sent events && openresty 集成试用

    前边有写过一个简单pushpin 集成stream 的demo,这次测试下sse 的功能 备注: 环境依然使用的是docker-compose运行 环境准备 docker-compose 文件 ver ...

  4. pushpin openresty 集成试用

    pushpin 是一个很不错的将restapi 转换为reailtime api 的proxy,openresty 具有很强的nginx 控制能力 可以方便的用来进行api 的开发,默认其他语言pus ...

  5. gearman openresty 集成试用

    很简单使用了一个openresty 的lua 模块 环境准备 docker-compose 文件 详细配置可以参考 https://github.com/rongfengliang/gearmango ...

  6. gogs wekan 集成试用

    wekan 官方提供了一个集成gogs 的扩展,不是完全的自动化,需要结合cli,但是官方的cli 写的...(不是很全) 备注: 测试环境使用docker-compose 环境准备 docker-c ...

  7. graphql elasticsearch 集成试用

    graphql 是很方便的api 查询语言,elasticsearch 可以方便的进行全文检索的应用开发 有一个方便的npm 包graphql-compose-elasticsearch 可以进行es ...

  8. hasura graphql server event trigger 试用

    hasura graphql server 是一个很不错的graphql 引擎,当前版本已经支持event triiger 了 使用此功能我们可以方便的集成webhook功能,实现灵活,稳定,快捷的消 ...

  9. Akka(27): Stream:Use case-Connecting Slick-dbStream & Scalaz-stream-fs2

    在以前的博文中我们介绍了Slick,它是一种FRM(Functional Relation Mapper).有别于ORM,FRM的特点是函数式的语法可以支持灵活的对象组合(Query Composit ...

随机推荐

  1. codeforces 930b//Game with String// Codeforces Round #468 (Div. 1)

    题意:一个串,右循环移位后,告诉你第一个字母,还能告诉你一个,问你能确定移位后的串的概率. 用map记录每个字母出现的位置.对于每个字母,用arr[j][k]记录它的所有出现位置的后j位是字母k的个数 ...

  2. Zepto常见问题

    Zepto遇到的问题 延时 总所周知,默认click事件,会有300ms的延时问题,Zepto的tap事件很好的解决了这个问题.但是也挖了一个大坑. 点透 Zepto的点透应该也是大家比较熟悉的了.当 ...

  3. JS冒泡排序的6种写法(武当雄风)

    天下英雄出我辈,一入江湖岁月催.鸿图霸业谈笑间,不胜人生一场醉. 武当山上,一年一度的试道大会又开始了... 众武当弟子摩拳擦掌都想在此次试道大会上一展风采... 张三丰临终前曾留下一句话:试道大会采 ...

  4. python-day21--os模块

     os模块是与操作系统交互的一个接口''' os.getcwd() 获取当前工作目录,即当前python脚本工作的目录路径 os.chdir("dirname") 改变当前脚本工作 ...

  5. nyoj-833-博弈

    833-取石子(七) 内存限制:64MB 时间限制:1000ms 特判: No通过数:16 提交数:30 难度:1 题目描述: Yougth和Hrdv玩一个游戏,拿出n个石子摆成一圈,Yougth和H ...

  6. HDU-5001 Walk (概率DP)

    Problem Description I used to think I could be anything, but now I know that I couldn't do anything. ...

  7. Harbor和YUM部署for CentOS 7

    Harbor部署for CentOS 7 下载 wget https://storage.googleapis.com/harbor-releases/release-1.7.0/harbor-off ...

  8. OC Foundation框架—集合

    Foundation框架—集合 一.NSArray和NSMutableArray (一)NSArray不可变数组 (1)NSArray的基本介绍 NSArray是OC中使用的数组,是面向对象的,以面向 ...

  9. ES6扩展运算符的几个小技巧

    es6扩展运算符,也就是...  ,作用是将一个数组转为用逗号分隔的参数序列. 那么问题来了,我们为啥要用这么奇怪的东东涅,当然因为它能大大提高我们的开发效率.所以,可别小看这三个点. 1.复制数组( ...

  10. PHP:第一章——PHP中十进制、二进制、八进制、十六进制转换

    //十进制.二进制.八进制.十六进制转换 //十进制转换为二进制decbin()函数: //echo decbin(5);//输出:101 //十进制转换为八进制decoct()函数 //echo d ...