All Projects → wework → grabbit

wework / grabbit

Licence: Apache-2.0 license
A lightweight transactional message bus on top of RabbitMQ

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to grabbit

OpenSleigh
OpenSleigh is a Saga management library for .NET Core.
Stars: ✭ 198 (+127.59%)
Mutual labels:  rabbitmq, saga, saga-pattern
spring-cloud-stream-outbox-extension
Spring Cloud Stream Transactional Messaging Extension
Stars: ✭ 18 (-79.31%)
Mutual labels:  rabbitmq, outbox
dtm
A distributed transaction framework that supports multiple languages, supports saga, tcc, xa, 2-phase message, outbox patterns.
Stars: ✭ 6,110 (+6922.99%)
Mutual labels:  saga, outbox
Saga
Saga pattern implementation in Kotlin build in top of Kotlin's Coroutines.
Stars: ✭ 24 (-72.41%)
Mutual labels:  saga, saga-pattern
Cap
Distributed transaction solution in micro-service base on eventually consistency, also an eventbus with Outbox pattern
Stars: ✭ 5,208 (+5886.21%)
Mutual labels:  rabbitmq, outbox
Kickoff Docker Php
🐳 🐘 🚀 Easily setup a PHP project with Docker
Stars: ✭ 213 (+144.83%)
Mutual labels:  rabbitmq
Prometheus rabbitmq exporter
Prometheus.io exporter as a RabbitMQ Managment Plugin plugin
Stars: ✭ 248 (+185.06%)
Mutual labels:  rabbitmq
Chef Cookbook
Development repository for Chef cookbook RabbitMQ
Stars: ✭ 212 (+143.68%)
Mutual labels:  rabbitmq
Rabbitmq Objc Client
RabbitMQ client for Objective-C and Swift
Stars: ✭ 207 (+137.93%)
Mutual labels:  rabbitmq
celery-kubernetes-example
Small Flask app with scalable, asynchronous backend workers deployed on Kubernetes.
Stars: ✭ 79 (-9.2%)
Mutual labels:  rabbitmq
nestjs-boilerplate-microservice
Nestjs Microservice boilerplate: apply DDD, CQRS, and Event Sourcing within an event driven architecture
Stars: ✭ 270 (+210.34%)
Mutual labels:  saga
Pika
Pure Python RabbitMQ/AMQP 0-9-1 client library
Stars: ✭ 2,866 (+3194.25%)
Mutual labels:  rabbitmq
Digital Restaurant
DDD. Event sourcing. CQRS. REST. Modular. Microservices. Kotlin. Spring. Axon platform. Apache Kafka. RabbitMQ
Stars: ✭ 222 (+155.17%)
Mutual labels:  rabbitmq
react-truffle-metamask
Build an DApp using react, redux, saga, truffle, metamask
Stars: ✭ 25 (-71.26%)
Mutual labels:  saga
Asky
Asky开源架构:极简、轻量、极致性能《Asky零基础1小时学编程 dnc+vue+tidb+redis+rabbitMQ+ES》QQ群 779699538
Stars: ✭ 213 (+144.83%)
Mutual labels:  rabbitmq
microservices-transactions
Choreography-based sagas to maintain data consistency in a microservice architecture.
Stars: ✭ 20 (-77.01%)
Mutual labels:  saga-pattern
Springcloudexamples
Spring Cloud 学习教程
Stars: ✭ 208 (+139.08%)
Mutual labels:  rabbitmq
Rusty Celery
🦀 Rust implementation of Celery for producing and consuming background tasks
Stars: ✭ 243 (+179.31%)
Mutual labels:  rabbitmq
react-project-tpl
react project template
Stars: ✭ 32 (-63.22%)
Mutual labels:  saga
Rabbitmq Zabbix
Zabbix RabbitMQ Configuration
Stars: ✭ 241 (+177.01%)
Mutual labels:  rabbitmq

CircleCI Go Report Card Coverage Status GitHub release

grabbit

A lightweight transactional message bus on top of RabbitMQ supporting:

  1. Supported Messaging Styles
    • One Way (Fire and forget)
    • Publish/Subscribe
    • Aync Command/Reply
    • Blocking Command/Reply (RPC)
  2. Transactional message processing
  3. Message Orchestration via the Saga pattern
  4. At least once reliable messaging via Transaction Outbox and Publisher Confirms
  5. Retry and backoffs
  6. Structured logging
  7. Reporting Metrics via Prometheus
  8. Distributed Tracing via OpenTracing
  9. Extensible serialization with default support for gob, protobuf and avro

Stable release

the v1.x branch contains the latest stable releases of grabbit and one should track that branch to get point and minor release updates.

Supported transactional resources

  1. MySql > 8.0 (InnoDB)

Basic Usage

  • For a complete sample application see the vacation booking sample app in the examples directory

The following outlines the basic usage of grabbit. For a complete view of how you would use grabbit including how to write saga's and handle deadlettering refer to grabbit/tests package

import (
  "github.com/wework/grabbit/gbus"
  "github.com/wework/grabbit/gbus/builder"
)

Define a message

type SomeMessage struct {}

func(SomeMessage) SchemaName() string{
   return "some.unique.namespace.somemessage"
}

Creating a transactional GBus instance

gb := builder.
        New().
    Bus("connection string to RabbitMQ").
    Txnl("mysql", "connection string to mysql").
    WithConfirms().
    Build("name of your service")

Register a command handler

handler := func(invocation gbus.Invocation, message *gbus.BusMessage) error{
    cmd, ok := message.Payload.(*SomeCommand)
    if ok {
      fmt.Printf("handler invoked with  message %v", cmd)
            return nil
    }

        return fmt.Errorf("failed to handle message")
  }

gb.HandleMessage(SomeCommand{}, handler)

Register an event handler

eventHandler := func(invocation gbus.Invocation, message *gbus.BusMessage) {
    evt, ok := message.Payload.(*SomeEvent)
    if ok {
      fmt.Printf("handler invoked with event %v", evt)
            return nil
    }

        return fmt.Errorf("failed to handle event")
  }

gb.HandleEvent("name of exchange", "name of topic", SomeEvent{}, eventHandler)

Start the bus

gb.Start()
defer gb.Shutdown()

Send a command

gb.Send(context.Background(), "name of service you are sending the command to", gbus.NewBusMessage(SomeCommand{}))

Publish an event

gb.Publish(context.Background(), "name of exchange", "name of topic", gbus.NewBusMessage(SomeEvent{}))

RPC style call

request := gbus.NewBusMessage(SomeRPCRequest{})
reply := gbus.NewBusMessage(SomeRPCReply{})
timeOut := 2 * time.Second

reply, e := gb.RPC(context.Background(), "name of service you are sending the request to", request, reply, timeOut)

if e != nil{
  fmt.Printf("rpc call failed with error %v", e)
} else{
  fmt.Printf("rpc call returned with reply %v", reply)
}

Testing

  1. ensure that you have the dependencies installed: go get -v -t -d ./...
  2. make sure to first: docker-compose up -V -d
  3. then to run the tests: go test ./...
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].