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

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

一张参考图

环境搭建

使用docker-compose

  • docker-compose 文件
  1. version: '3.6'
  2. services:
  3. postgres:
  4. image: postgres
  5. ports:
  6. - "5432:5432"
  7. environment:
  8. - "POSTGRES_PASSWORD:dalong"
  9. volumes:
  10. - ./db_data:/var/lib/postgresql/data
  11. benthos:
  12. image: jeffail/benthos
  13. volumes:
  14. - "./configs/webhook.yaml:/benthos.yaml"
  15. ports:
  16. - "4195:4195"
  17. graphql-engine:
  18. image: hasura/graphql-engine:v1.0.0-alpha16
  19. ports:
  20. - "8080:8080"
  21. depends_on:
  22. - "postgres"
  23. environment:
  24. - "POSTGRES_PASSWORD:dalong"
  25. command: >
  26. /bin/sh -c "
  27. graphql-engine --database-url postgres://postgres:dalong@postgres:5432/postgres serve --enable-console;
  28. "
  • benthos webhook 配置
    webhook.yaml 文件
  1. input:
  2. type: broker
  3. broker:
  4. inputs:
  5. - type: http_server
  6. http_server:
  7. path: /post/customer1
  8. processors:
  9. - type: text
  10. text:
  11. operator: prepend
  12. value: "Customer 1 received: "
  13. - type: http_server
  14. http_server:
  15. path: /post/customer2
  16. processors:
  17. - type: text
  18. text:
  19. operator: prepend
  20. value: "Customer 2 received: "
  21. - type: http_server
  22. http_server:
  23. path: /post/customer3
  24. processors:
  25. - type: text
  26. text:
  27. operator: prepend
  28. value: "Customer 3 received: "
  29. output:
  30. type: stdout

启动&&运行

  • 启动graphql server&& benthos stream webhook
  1. 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. 3.5 MIPS体系结构

    计算机组成 3 指令系统体系结构 3.5 MIPS体系结构 MIPS是精简指令系统的代表,采用了与X86相反的设计理念,并引领了精简指令系统的潮流,那就让我们一起来看一看这究竟是怎么一回事. 要探讨M ...

  2. AndroidStudio使用偷懒插件Butterknife和GsonFormat

    1.Android ButterKnife Zelezny Android Studio上安装插件,如图: 配合ButterKnife实现注解,从此不用写findViewById,想着就爽啊.在Act ...

  3. Mysql查询用逗号分隔的字段-字符串函数FIND_IN_SET(),以及此函数与in()函数的区别

    查询用逗号分隔的字段,可以用字符串函数FIND_IN_SET(): 查询数据库表中某个字段(值分行显示),可以用函数in(). 今天工作中遇到一个问题,就是用FIND_IN_SET()函数解决的. 第 ...

  4. UVA-10995 Educational Journey

    The University of Calgary team qualified for the 28th ACM International Collegiate Programming Conte ...

  5. linux shard virtual memory

  6. IScroll的诞生和缺点

    转自http://lhdst-163-com.iteye.com/blog/1239784 iscroll.js是Matteo Spinelli开发的一个js文件,使用原生js编写,不依赖与任何js框 ...

  7. bzoj2662

    题解: spfa最短路径 dp[i][j]表示到i,用了j掌权 然后转移 代码: #include<bits/stdc++.h> using namespace std; ; int n, ...

  8. 模拟QQ分组(具有伸缩功能) (添加开源框架的光闪烁效果)SimpleExpandableListAdapter 适配器的用法,并且可添加组及其组内数据。

    package com.lixu.qqfenzu; import java.util.ArrayList; import java.util.HashMap; import java.util.Lis ...

  9. Delphi中的文件扩展名

    Filename Extensions in Delphi http://delphi.about.com/od/beginners/a/aa032800a.htm Try building a sm ...

  10. The "Double-Checked Locking is Broken" Declaration

    双重检查锁定在延迟初始化的单例模式中见得比较多(单例模式实现方式很多,这里为说明双重检查锁定问题,只选取这一种方式),先来看一个版本: public class Singleton { private ...