Skip to content

Trigon connects to MySQL bin-log stream and processes it with different pipes

License

Notifications You must be signed in to change notification settings

fullpipe/trigon

Repository files navigation

trigon

Trigon connects to MySQL bin-log stream and processes it with different pipes

Install

go get -u github.com/fullpipe/trigon

Usage

trigon -config=trigon.yaml

Configuration with examples

# trigon.yaml
input:
  host: 127.0.0.1:3320 # mysql host
  user: root
  password: root
triggers:
  - name: "Post webhook after 1000 user creations"
    pipes:
      - ["table_filter", ["user"]]
      - ["action_filter", ["insert"]]
      - ["every", 1000]
      - ["debounce", 5000]
      - ["webhook", { url: https://hookb.in/mZaZlXYLpjueqq710Ypk, method: POST }]

  - name: "Start data aggregation on leads updates"
    pipes:
      - ["table_filter", ["lead"]]
      - ["action_filter", ["insert", "update"]]
      - ["every", 10000]
      - ["debounce", 3600000] # debounce for one hour
      - ["log", { prefix: "Calculate leads aggregation" }]
      - ["amqp", { dsn: "amqp://guest:guest@localhost:5672/", exchange: "lead", routing_key: "lead.aggregate" }]

  - name: "Try every pipe on transactions"
    pipes:
      - ["log", { prefix: "All in one start: ", output: "file", "path": "./log.log" }]
      - ["table_filter", ["transaction"]]
      - ["action_filter", ["insert", "update", "delete"]]
      - ["every", 2]
      - ["debounce", 5000]
      - ["webhook", { url: https://hookb.in/mZaZlXYLpjueqq710Ypk, method: POST }]
      - ["amqp", { dsn: "amqp://guest:guest@localhost:5672/", exchange: "test1", routing_key: "order" }]
      - ["log", { prefix: "All in one end: " }]

TODO

  • yaml config
    • input
    • triggers
      • pipes
      • output
  • tests
  • pipes

About

Trigon connects to MySQL bin-log stream and processes it with different pipes

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages