{"id":36863125,"url":"https://github.com/zerjioang/go-bus","last_synced_at":"2026-01-12T14:51:38.012Z","repository":{"id":57483715,"uuid":"161559404","full_name":"zerjioang/go-bus","owner":"zerjioang","description":"a deadly simple thread-safe, zero-alloc event bus for Golang","archived":false,"fork":false,"pushed_at":"2019-04-27T20:20:40.000Z","size":42,"stargazers_count":9,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-13T19:28:31.781Z","etag":null,"topics":["embedded","eventbus","golang","mq","pubsub"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zerjioang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-12T23:52:22.000Z","updated_at":"2024-08-04T02:01:05.000Z","dependencies_parsed_at":"2022-08-28T17:02:14.243Z","dependency_job_id":null,"html_url":"https://github.com/zerjioang/go-bus","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/zerjioang/go-bus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerjioang%2Fgo-bus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerjioang%2Fgo-bus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerjioang%2Fgo-bus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerjioang%2Fgo-bus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zerjioang","download_url":"https://codeload.github.com/zerjioang/go-bus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerjioang%2Fgo-bus/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28340411,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["embedded","eventbus","golang","mq","pubsub"],"created_at":"2026-01-12T14:51:37.252Z","updated_at":"2026-01-12T14:51:38.001Z","avatar_url":"https://github.com/zerjioang.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"gobus\" src=\"https://user-images.githubusercontent.com/6706342/50519588-f3fb3700-0abb-11e9-965f-f582b46b7b46.png\" width=\"500px\"\u003e\u003c/img\u003e\n  \u003ch3 align=\"center\"\u003e\u003cb\u003ePubSub Event bus for Go\u003c/b\u003e\u003c/h3\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://travis-ci.org/zerjioang/go-bus\"\u003e\n      \u003cimg alt=\"Build Status\" src=\"https://travis-ci.org/zerjioang/go-bus.svg?branch=master\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://goreportcard.com/report/github.com/zerjioang/go-bus\"\u003e\n       \u003cimg alt=\"Go Report Card\" src=\"https://goreportcard.com/badge/github.com/zerjioang/go-bus\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/zerjioang/go-bus/blob/master/LICENSE\"\u003e\n        \u003cimg alt=\"Software License\" src=\"http://img.shields.io/:license-gpl3-brightgreen.svg?style=flat-square\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://godoc.org/github.com/zerjioang/go-bus\"\u003e\n       \u003cimg alt=\"Build Status\" src=\"https://godoc.org/github.com/zerjioang/go-bus?status.svg\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\nPackage **go-bus** is a thread-safe, **zero-alloc**, pub-sub event bus for embebbed go apps and microservices.\n\n## Install\n\n```bash\ngo get github.com/zerjioang/go-bus\n```\n\n## TL;DR\n\n```go\nfunc TestExampleCalculationBus(t *testing.T) {\n\t//define a global bus instance\n\tbus := mutex.NewBus()\n\n\t//register our subscriber: the calculation engine\n\tbus.Subscribe(\"calc\", func(message gobus.EventMessage) {\n\t\tprintln(\"new calculation request arrived\")\n\t\ta := message.Get(\"a\").(int)\n\t\tb := message.Get(\"b\").(int)\n\t\tprintln(\"received a = \", a)\n\t\tprintln(\"received b = \", b)\n\t\tprintln(\"the sum is\", a+b)\n\t})\n\n\t//register our data publisher\n\tbus.Send(\"calc\", gobus.EventPayload{\n\t\t\"a\": 5,\n\t\t\"b\": 10,\n\t})\n\n\tbus.Send(\"calc\", gobus.EventPayload{\n\t\t\"a\": 8,\n\t\t\"b\": 12,\n\t})\n\n\tbus.Shutdown()\n}\n```\n\n```bash\nnew calculation request arrived\nnew calculation request arrived\nreceived a =  5\nreceived b =  10\nreceived a =  8\nreceived b =  12\nthe sum is 15\nthe sum is 20\n```\n\n## Benchmarking\n\nAlways do benchmarking with your own data. Here are mine:\n\n### For mutex based version\n\n```bash\nBenchmarkEventBus/instantiation-4                     2000000000\t         0.42 ns/op\t2394.34 MB/s\t       0 B/op\t       0 allocs/op\nBenchmarkEventBus/instantiation-ptr-                  2000000000\t         0.43 ns/op\t2310.56 MB/s\t       0 B/op\t       0 allocs/op\nBenchmarkEventBus/str-to-uint32-4                       50000000\t        37.6 ns/op\t  26.56 MB/s\t       0 B/op\t       0 allocs/op\nBenchmarkEventBus/subscribe-4                            5000000\t       274 ns/op\t   3.64 MB/s\t      43 B/op\t       0 allocs/op\nBenchmarkEventBus/subscribe-invalid-no-name-4          500000000\t         3.38 ns/op\t 295.51 MB/s\t       0 B/op\t       0 allocs/op\nBenchmarkEventBus/subscribe-invalid-no-listener-4      300000000\t         4.20 ns/op\t 238.03 MB/s\t       0 B/op\t       0 allocs/op\nBenchmarkEventBus/publish-no-subscriber-4                3000000\t       468 ns/op\t   2.13 MB/s\t       0 B/op\t       0 allocs/op\nBenchmarkEventBus/publish-with-subscriber-4              3000000\t       476 ns/op\t   2.10 MB/s\t       0 B/op\t       0 allocs/op\nBenchmarkEventBus/pub-sub-4                               100000\t     79957 ns/op\t   0.01 MB/s\t      48 B/op\t       0 allocs/op\nPASS\n```\n\nSpecial thanks to http://ernestmicklei.com/2014/11/guava-like-eventbus-for-go/ for it's original approach\n\n## License\n\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n * Uses GPL license described below\n\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerjioang%2Fgo-bus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzerjioang%2Fgo-bus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerjioang%2Fgo-bus/lists"}