All Projects → nicholasjackson → Pipe

nicholasjackson / Pipe

Licence: mit
Multi provider event grid written in go

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Pipe

watermill-nats
NATS Pub/Sub for the Watermill project.
Stars: ✭ 25 (+177.78%)
Mutual labels:  events, nats
Watermill
Building event-driven applications the easy way in Go.
Stars: ✭ 3,504 (+38833.33%)
Mutual labels:  events, nats
Twitchlib
C# Twitch Chat, Whisper, API and PubSub Library. Allows for chatting, whispering, stream event subscription and channel/account modification. Supports .NET Core 2.0
Stars: ✭ 519 (+5666.67%)
Mutual labels:  events
Phly Event Dispatcher
Experimental PSR-14 implementation, tracking the specification.
Stars: ✭ 24 (+166.67%)
Mutual labels:  events
Hemera
🔬 Writing reliable & fault-tolerant microservices in Node.js https://hemerajs.github.io/hemera/
Stars: ✭ 773 (+8488.89%)
Mutual labels:  nats
Vue Global Events
⌨️ Register global events as a component
Stars: ✭ 638 (+6988.89%)
Mutual labels:  events
Laravel Event Broadcast
Laravel event broadcasting with Node.js, Redis & Socket.io
Stars: ✭ 5 (-44.44%)
Mutual labels:  events
Kledex
.NET Standard framework to create simple and clean design. Advanced features for DDD, CQRS and Event Sourcing.
Stars: ✭ 502 (+5477.78%)
Mutual labels:  events
Nats.rb
Ruby client for NATS, the cloud native messaging system.
Stars: ✭ 850 (+9344.44%)
Mutual labels:  nats
Domtastic
Small, fast, and modular DOM and event library for modern browsers.
Stars: ✭ 763 (+8377.78%)
Mutual labels:  events
Thenetwork Open
TheNetwork is a blog cum chat app. It's completely built using firebase. Users can post, comment, like and bookmark the blogs, also users can send follow requests to connect with people. Users can create events and also prepare an event roadmap. Pagination for realtime data is also included in chats, blogs and events.
Stars: ✭ 17 (+88.89%)
Mutual labels:  events
Eventrouter
A simple introspective kubernetes service that forwards events to a specified sink.
Stars: ✭ 671 (+7355.56%)
Mutual labels:  events
Telemetry
Dynamic dispatching library for metrics and instrumentations.
Stars: ✭ 647 (+7088.89%)
Mutual labels:  events
Evented
Fire and listen to events in JavaScript
Stars: ✭ 6 (-33.33%)
Mutual labels:  events
Transient
A full stack, reactive architecture for general purpose programming. Algebraic and monadically composable primitives for concurrency, parallelism, event handling, transactions, multithreading, Web, and distributed computing with complete de-inversion of control (No callbacks, no blocking, pure state)
Stars: ✭ 617 (+6755.56%)
Mutual labels:  events
Remit
RabbitMQ-backed microservices supporting RPC, pubsub, automatic service discovery and scaling with no code changes.
Stars: ✭ 24 (+166.67%)
Mutual labels:  events
Lwt
OCaml promises and concurrent I/O
Stars: ✭ 505 (+5511.11%)
Mutual labels:  events
Laravel Event Projector
Event sourcing for Artisans 📽
Stars: ✭ 650 (+7122.22%)
Mutual labels:  events
Laravel Google Calendar
Manage events on a Google Calendar
Stars: ✭ 787 (+8644.44%)
Mutual labels:  events
Vector
A reliable, high-performance tool for building observability data pipelines.
Stars: ✭ 8,736 (+96966.67%)
Mutual labels:  events

Pipe - Event Grid and Message Router

Docker Repository on Quay CircleCI Maintainability

This project allows you to listen to a variety of message sources and perform an action when a message is received. The documentation and the project is currently work in progress however curretly supported providers are:

  • Nats.io - read and write to nats streaming
  • HTTP - receive and send events over http

The project is built around a provider model where plugable elements can be added to the server to allow support for a variety of message sources.

Planned providers:

  • Log files - read and write to log files
  • SQS - AWS Simple Message Queue
  • PubSub - Google pub sub
  • Kafka
  • And more.

Configuration

To configure pipes HCL configuration file is used...

# Input block, will listen for nats messages on defined queue
input "nats_queue" "nq_in" {
  server = "nats://nats.service.consul:4222"
  cluster_id = "test-cluster"
  queue = "testmessagequeue"
}

# Output block, defines a http output
output "http" "nq_out" {
  protocol = "http"
  server = "localhost"
  port = 8080
  path = "/message"
}

pipe "accept_nats" {
  # Name of the input block
  input = "nq_in"

  # Do not handle messages older than
  expiration = "1h"

  # Action to perform when a new message is received
  action {
    # Name of the output
    output = "nq_out"

    # Transform the initial message
    template = <<EOF
      {
        "text": "Hey a picture from selfi drone",
        "image": "{{ .JSON.Data }}"
      }
    EOF

  }

  # Called when action succeedes
  on_success {
    output = "success"
  }
 
  on_success {
    output = "success"
  }

  # Called when the action fails
  on_fail {
    output = "fail"
  }
}

Template values

.Raw

Return raw binary data as an array of bytes from the message

.JSON

If the message type is application/json return an object which allows access to elements i.e.
Given:

{
  "Pets": [
    {"name": "fido"}
  ]
}

Then:

  {{ .JSON.Pets[0].name }} // fido

Note .JSON does not convert the output to JSON format, writing the direct output of .JSON.Pets would produce a go formatted object. To output json see the template function tojson.

Template functions

base64encode

Base64 encode []byte

input_template: |
{
  "image": "{{ base64encode .Raw }}"
}

base64decode

Base64 decode a string

input_template: |
  {{ base64decode .JSON.Image }}

tojson

Convert to valid json

input_template: |
  {{ tojson .JSON.Pets }}

Metrics

Metrics are exported using StatsD to import metrics into Prometheus please use the prometheus StatsD exporter https://hub.docker.com/r/prom/statsd-exporter/

Running the queue

To run the listener you can use the build docker container and provide a configuration file as a volume mount.

docker run -it \
  -v $(shell pwd)/examples:/etc/config \
  quay.io/nicholasjackson/faas-nats:latest \
  -config /etc/config/examples

Testing

There is a simple test harness in ./testharness/main.go which can be used to validate the subscription and transformations.

TODO

[x] Implement monitoring and metrics with StatsD
[ ] Finish documentation
[ ] Write more examples
[ ] Finish basic provider implementation

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].