{"id":13714076,"url":"https://github.com/wework/grabbit","last_synced_at":"2025-08-24T02:19:18.264Z","repository":{"id":41413291,"uuid":"179554098","full_name":"wework/grabbit","owner":"wework","description":"A lightweight transactional message bus on top of RabbitMQ","archived":false,"fork":false,"pushed_at":"2023-02-25T04:08:39.000Z","size":1881,"stargazers_count":100,"open_issues_count":26,"forks_count":20,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-08-13T20:55:05.950Z","etag":null,"topics":["go","golang","microservices","outbox","rabbitmq","reliable-messages","saga","saga-pattern","transactional-message-exchange"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wework.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-04T18:30:07.000Z","updated_at":"2025-05-12T21:24:08.000Z","dependencies_parsed_at":"2024-06-19T00:00:02.885Z","dependency_job_id":"81eb3596-1b1c-490a-9add-d394b9edb404","html_url":"https://github.com/wework/grabbit","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/wework/grabbit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wework%2Fgrabbit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wework%2Fgrabbit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wework%2Fgrabbit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wework%2Fgrabbit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wework","download_url":"https://codeload.github.com/wework/grabbit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wework%2Fgrabbit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271780500,"owners_count":24819293,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-24T02:00:11.135Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","microservices","outbox","rabbitmq","reliable-messages","saga","saga-pattern","transactional-message-exchange"],"created_at":"2024-08-02T23:01:51.160Z","updated_at":"2025-08-24T02:19:18.233Z","avatar_url":"https://github.com/wework.png","language":"Go","funding_links":[],"categories":["Repositories"],"sub_categories":[],"readme":"\n[![CircleCI](https://circleci.com/gh/wework/grabbit.svg?style=svg)](https://circleci.com/gh/wework/grabbit)\n[![Go Report Card](https://goreportcard.com/badge/github.com/wework/grabbit)](https://goreportcard.com/report/github.com/wework/grabbit)\n[![Coverage Status](https://coveralls.io/repos/github/wework/grabbit/badge.svg?branch=master)](https://coveralls.io/github/wework/grabbit?branch=master)\n![GitHub release](https://img.shields.io/github/release/wework/grabbit.svg)\n\n\n\n# grabbit\n\nA lightweight transactional message bus on top of RabbitMQ supporting:\n\n1) Supported [Messaging Styles](https://github.com/wework/grabbit/blob/master/docs/MESSAGING.md) \n    - One Way (Fire and forget)\n    - Publish/Subscribe\n    - Aync Command/Reply\n    - Blocking Command/Reply (RPC)\n2) [Transactional](https://github.com/wework/grabbit/blob/master/docs/TX.md) message processing\n3) Message Orchestration via the [Saga](https://github.com/wework/grabbit/blob/master/docs/SAGA.md) pattern\n4) At least once reliable messaging via [Transaction Outbox](https://github.com/wework/grabbit/blob/master/docs/OUTBOX.md) and [Publisher Confirms](https://github.com/wework/grabbit/blob/master/docs/OUTBOX.md)\n5) [Retry and backoffs](https://github.com/wework/grabbit/blob/master/docs/RETRY.md)\n6) [Structured logging](https://github.com/wework/grabbit/blob/master/docs/LOGGING.md)\n7) Reporting [Metrics](https://github.com/wework/grabbit/blob/master/docs/METRICS.md) via Prometheus\n8) Distributed [Tracing](https://github.com/wework/grabbit/blob/master/docs/TRACING.md) via OpenTracing\n9) [Extensible serialization](https://github.com/wework/grabbit/blob/master/docs/SERIALIZATION.md) with default support for gob, protobuf and avro\n\n## Stable release\nthe v1.x branch contains the latest stable releases of grabbit and one should track that branch to get point and minor release updates.\n\n## Supported transactional resources\n1) MySql \u003e 8.0 (InnoDB)\n\n## Basic Usage\n\n- For a complete sample application see the vacation booking [sample app](https://github.com/wework/grabbit/blob/master/examples/vacation_app) in the examples directory\n\nThe following outlines the basic usage of grabbit.\nFor a complete view of how you would use grabbit including how to write saga's and handle deadlettering refer to grabbit/tests package\n\n\n```Go\nimport (\n  \"github.com/wework/grabbit/gbus\"\n  \"github.com/wework/grabbit/gbus/builder\"\n)\n\n```\nDefine a message\n\n```Go\ntype SomeMessage struct {}\n\nfunc(SomeMessage) SchemaName() string{\n   return \"some.unique.namespace.somemessage\"\n}\n\n```\n\nCreating a transactional GBus instance\n```Go\ngb := builder.\n        New().\n    Bus(\"connection string to RabbitMQ\").\n    Txnl(\"mysql\", \"connection string to mysql\").\n    WithConfirms().\n    Build(\"name of your service\")\n\n```\nRegister a command handler\n\n```Go\n\n\nhandler := func(invocation gbus.Invocation, message *gbus.BusMessage) error{\n    cmd, ok := message.Payload.(*SomeCommand)\n    if ok {\n      fmt.Printf(\"handler invoked with  message %v\", cmd)\n            return nil\n    }\n\n        return fmt.Errorf(\"failed to handle message\")\n  }\n\ngb.HandleMessage(SomeCommand{}, handler)\n```\nRegister an event handler\n\n```Go\n\n\neventHandler := func(invocation gbus.Invocation, message *gbus.BusMessage) {\n    evt, ok := message.Payload.(*SomeEvent)\n    if ok {\n      fmt.Printf(\"handler invoked with event %v\", evt)\n            return nil\n    }\n\n        return fmt.Errorf(\"failed to handle event\")\n  }\n\ngb.HandleEvent(\"name of exchange\", \"name of topic\", SomeEvent{}, eventHandler)\n\n```\n\nStart the bus\n```Go\ngb.Start()\ndefer gb.Shutdown()\n```\n\nSend a command\n```Go\ngb.Send(context.Background(), \"name of service you are sending the command to\", gbus.NewBusMessage(SomeCommand{}))\n```\nPublish an event\n```Go\ngb.Publish(context.Background(), \"name of exchange\", \"name of topic\", gbus.NewBusMessage(SomeEvent{}))\n```\n\nRPC style call\n```Go\n\n\nrequest := gbus.NewBusMessage(SomeRPCRequest{})\nreply := gbus.NewBusMessage(SomeRPCReply{})\ntimeOut := 2 * time.Second\n\nreply, e := gb.RPC(context.Background(), \"name of service you are sending the request to\", request, reply, timeOut)\n\nif e != nil{\n  fmt.Printf(\"rpc call failed with error %v\", e)\n} else{\n  fmt.Printf(\"rpc call returned with reply %v\", reply)\n}\n\n```\n\n## Testing\n\n0) ensure that you have the dependencies installed: `go get -v -t -d ./...`\n1) make sure to first: `docker-compose up -V -d`\n2) then to run the tests: `go test ./...`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwework%2Fgrabbit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwework%2Fgrabbit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwework%2Fgrabbit/lists"}