测试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. JVM中对象的内存布局与访问定位

      一.对象的内存布局 已主流的HotSpot虚拟机来说,   在HotSpot虚拟机中,对象在内存中存储的布局可以分为3块区域:对象头(Header).实例数据(Instance Data)和对齐填 ...

  2. java克隆机制

    看了下面博客就很明白了 http://www.cnblogs.com/Qian123/p/5710533.html#_label0 java对象创建方式有三种: 1.通过new对象 2.通过java克 ...

  3. LeetCode--172--阶乘后的0

    问题描述: 给定一个整数 n,返回 n! 结果尾数中零的数量. 示例 1: 输入: 3 输出: 0 解释: 3! = 6, 尾数中没有零. 示例 2: 输入: 5 输出: 1 解释: 5! = 120 ...

  4. 5-11敏捷开发rails的章节: Rspec(使用方法) ,Slim(使用操作简介)

    Rspec: test Slim :可以取代ERB的模版语言.(简单了解了以下,方便写代码,但我觉得不方便读.还是用原生的html) Webpack管理css: 不再使用app/assets/styl ...

  5. PHP函数总结 (六)

    <?php /** * 递归函数(自调用函数): * 在函数体内直接或间接的自己调用自己 * 通常有一个条件判断是否需要执行递归,并且在特定条件下终止函数的递归调用动作,把目前流程的主控制权交回 ...

  6. 第 4 章—— C# 语言特性(《精通 ASP.NET MVC 5》)

    这里只提供各个特性的简单概括. C# 的完整指南可参阅<Introducing Visual C#>.深度了解 LINQ 可参考<Pro LINQ in C#> 4.1 准备示 ...

  7. OC description和sel

    一.description方法 Description方法包括类方法和对象方法.(NSObject类所包含) (一)基本知识 -description(对象方法) 使用NSLog和@%输出某个对象时, ...

  8. Idea检入boss项目

    Idea检入boss项目  

  9. laravel更新时区:

    config/app.php 'timezon'='UTC'  或 'timezone'='Asia/Shanghai'

  10. 微信小程序-注册和第一个demo

    第一篇 申请帐号 https://mp.weixin.qq.com/cgi-bin/registermidpage?action=index&lang=zh_CN 这里注册帐号,记得选小程序, ...