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

webhook 使用benthos ,简单例子参考 https://www.cnblogs.com/rongfengliang/p/9569811.html

一张参考图

环境搭建

使用docker-compose

  • docker-compose 文件
version: '3.6'
services:
postgres:
image: postgres
ports:
- "5432:5432"
environment:
- "POSTGRES_PASSWORD:dalong"
volumes:
- ./db_data:/var/lib/postgresql/data
benthos:
image: jeffail/benthos
volumes:
- "./configs/webhook.yaml:/benthos.yaml"
ports:
- "4195:4195"
graphql-engine:
image: hasura/graphql-engine:v1.0.0-alpha16
ports:
- "8080:8080"
depends_on:
- "postgres"
environment:
- "POSTGRES_PASSWORD:dalong"
command: >
/bin/sh -c "
graphql-engine --database-url postgres://postgres:dalong@postgres:5432/postgres serve --enable-console;
"
  • benthos webhook 配置
    webhook.yaml 文件
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

启动&&运行

  • 启动graphql server&& benthos stream webhook
docker-compose up -d
  • 效果

测试event trigger

  • 添加基本数据
  • 添加evnet triiger

    具体webhook 地址参考自己电脑ip,我使用docker-compose 的service

  • 添加数据测试

说明

类似的支持框架有prisma 都是挺不错的,但是hasura graphql 看起来潜力是无限的,只是在crud 这方便如果能扩展到不止pg 就更好了。

参考资料

https://www.cnblogs.com/rongfengliang/p/9569811.html
https://hasura.io/
https://github.com/Jeffail/benthos/tree/master/resources/docker/streams
https://github.com/rongfengliang/hasura-graphql-event-benthos

 
 
 
 

hasura graphql server event trigger 试用的更多相关文章

  1. hasura graphql server 集成gatsby

    hasura graphql server 社区基于gatsby-source-graphql 开发了gatsby-postgres-graphql 插件, 可以快速的开发丰富的网站 基本使用 安装h ...

  2. hasura graphql server 集成gitlab

    默认官方是提供了gitlab 集成的demo的,但是因为gitlab 一些版本的问题, 跑起来总有问题,所以查找相关资料测试了一个可以运行的版本 项目使用docker-compose 运行 参考 ht ...

  3. hasura graphql server (haskell)构建

    安装 &&运行pg(docker) version: '3.6' services: postgres: image: postgres environment: - "PO ...

  4. gqlgen golang graphql server 基本试用

    gqlgen golang 的graphql server 具体代码参考https://github.com/rongfengliang/gqlgen-demo 特点 模型优先 类型安全 代码生成 安 ...

  5. hasura graphql subscriptions 使用

      subscriptions graphql 的一项实时数据推送的功能,还是很方便的,自己在直接使用subscriptions-transport-ws npm 包 的时候运行一直有错误(主要是依赖 ...

  6. SAP CRM 使用Javascript触发SAP Server Event

    原文地址:How To Trigger SAP Server Event With Javascript 本文地址:http://www.cnblogs.com/hhelibeb/p/5977921. ...

  7. hasura graphql auth-webhook api 说明

    hasura graphql 生产的使用是推荐使用webhook 进行角色访问控制的,官方同时提供了一个nodejs 的简单demo 代码 git clone https://github.com/h ...

  8. hasura graphql pg 自定义函数的使用

      hasura graphql 的安装可以参考相关项目 创建函数 数据表创建 CREATE TABLE sql_function_table ( id SERIAL PRIMARY KEY, inp ...

  9. 第二十五课:jQuery.event.trigger的源码解读

    本课主要来讲解jQuery.event.trigger的源码解读. trigger = function(event, data, elem, onlyHandlers){ if(elem & ...

随机推荐

  1. codeforces 1042d//Petya and Array// Codeforces Round #510 (Div. 2)

    题意:给出一个数组,求其中和小于t的区间数. 先计算前缀和数组sum[i].对当前的sum[i],查询树状数组中有几个比(sum[i]-t)大的数,那么用sum[i]减它就是一个合法区间.再将当前的s ...

  2. Spring Boot 文档

    本节对 Spring Boot 的参考文档做了一个简单概述.本章节对全文的参考手册进行内容上的一些索引. 你可以参考本节,从头到尾依次阅读该文档,也可以跳过不感兴趣的内容. Spring Boot 参 ...

  3. ORA-14452:试图创建,更改或删除正在使用的临时表中的索引

    因为表kol_xx_fin050_temp 为临时表,而且有其他session正在使用. select vs.* from v$session vs , v$lock vl , dba_objects ...

  4. OC 内存管理之手动内存管理MRC

    一.基本原理 1.什么是内存管理 内存管理的重要性: 移动设备的内存极其有限,每个app所能占用的内存是有限制的 当app所占用的内存较多时,系统会发出内存警告,这时得回收一些不需要再使用的内存空间. ...

  5. Windows系统配置Python环境,python2和python3共存

      Windows系统配置python2和python3共存   1.下载python: https://www.python.org/downloads/ 注:选择需要的版本(python2 or ...

  6. python 绘图 异常点绘制使用 ax.plot(abnormal_points['ds'], abnormal_points['y'], "rX", label='abnormal points')

    from matplotlib import pyplot as plt def my_plot(title, m, fcst, ax=None, uncertainty=True, plot_cap ...

  7. 解决mac更新系统后git无法使用

    这只是个小笔记啊,记着以后忘了可以再找出来,你们遇到了这个问题也可以翻出来看,废话不多说了,直接讲吧 一.无法使用的原因 mac  更新系统后  git命令无法使用,输入git命令会出现这样的提示 进 ...

  8. POJ 1754 线段树

    e,应该是线段树里的水题.线段树单点更新.查询区间最值. 代码套用模板 PS :模板有些地方不太懂. #include<stdio.h>#include<iostream>#i ...

  9. HeadFirstJava

    java执行过程的来龙去脉 源代码——编译器——输出——java虚拟机 扩展名为.java ——扩展名为.class 不要直接用类名点变量来改变属性值,一般都用get.set方法.封装的基本原则:将你 ...

  10. typedef struct用法详解与小结

    1.基本解释 typedef为C语言的关键字,作用是为一种数据类型定义一个新名字,这里的数据类型包括内部数据类型(int,char等)和自定义的数据类型(struct等). 在编程中使用typedef ...